标签:io ar color os sp for on art bs
int Init ( ESContext *esContext )void Draw ( ESContext *esContext )
{
UserData *userData = esContext->userData;
// Set the viewport
glViewport ( 0, 0, esContext->width, esContext->height );
// Clear the color buffer
glClear ( GL_COLOR_BUFFER_BIT );
// Use the program object
glUseProgram ( userData->programObject );
// Load the vertex position
glVertexAttribPointer ( userData->positionLoc, 3, GL_FLOAT,
GL_FALSE, 3 * sizeof(GLfloat), userData->vertices );
glEnableVertexAttribArray ( userData->positionLoc );
// Load the MVP matrix
glUniformMatrix4fv( userData->mvpLoc, 1, GL_FALSE, (GLfloat*) &userData->mvpMatrix.m[0][0] );
// Draw the cube
glDrawElements ( GL_TRIANGLES, userData->numIndices, GL_UNSIGNED_SHORT, userData->indices );
}
------------
注意: glGetAttribLocation 及 glVertexAttribPointer;
注意: glGetUniformLocation 及 glUniformMatrix4fv;
OpenGLShader 编程系列-属性变量,一致变量的传递
标签:io ar color os sp for on art bs
原文地址:http://blog.csdn.net/zangle260/article/details/41804799