In the stock OpenGL ES app you get (when you create a new "OpenGL game" in XCode), in the setupGL
function, there is:
glEnable(GL_DEPTH_TEST);
//glGenVertexArraysOES( 1, &_vertexArray ) ; // va's are not being used!
//glBindVertexArrayOES( _vertexArray ) ; // we comment these out
// to no ill effect -- are these calls extraneous?
glGenBuffers( 1, &_vertexBuffer ) ;
glBindBuffer( GL_ARRAY_BUFFER, _vertexBuffer ) ;
glBufferData( GL_ARRAY_BUFFER, sizeof(gCubeVertexData), gCubeVertexData, GL_STATIC_DRAW ) ;
glEnableVertexAttribArray(GLKVertexAttribPosition);
glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 24, BUFFER_OFFSET(0));
glEnableVertexAttribArray(GLKVertexAttribNormal);
glVertexAttribPointer(GLKVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 24, BUFFER_OFFSET(12));
//glBindVertexArrayOES(0);
However, it doesn't seem that vertex arrays are being used, (far as I know, vertex arrays stay in client memory while vertex buffers are parked on OpenGL server memory).
If you comment out the glBindVertexArrayOES
commands, the code seems to work exactly the same.
Are the glBindVertexArrayOES
calls extraneous in this xCode sample?