In the OpenGL ES application that you get (when you create a new "OpenGL game" in Xcode), the setupGL function has:
glEnable(GL_DEPTH_TEST); //glGenVertexArraysOES( 1, &_vertexArray ) ; // va 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 seems that vertex arrays are not used (as far as I know, vertex arrays remain in client memory, and vertex buffers are parked in OpenGL server memory).
If you comment out the glBindVertexArrayOES , the code seems to work the exact same way.
Are glBindVertexArrayOES calls extraneous in this xCode example?
source share