I'm just wondering why we need to call glDisableClientState(GL_VERTEX_ARRAY) after the drawing of a vertex array. Is it possible to just leave it there for the next drawing? Is there any side effect of doing this?

  • 2
    \$\begingroup\$ Have you tried it? \$\endgroup\$
    – MichaelHouse
    Apr 14 '13 at 1:32

First of all I want to mention that client-side vertex arrays are deprecated in OpenGL 3.0 and removed in OpenGL 3.1 and above.

To answer your question: you can call glEnableClientState once and leave the state enabled as far as your drawing code requires the same state. For example, if you don't want to render normals arrays you don't want it to be enabled, so you call glDisableClientState.

Performance wise it's better not to change states too often, but it's usually impractical to leave some states always enabled, hence affecting the whole application.

Also note that drivers that support OpenGL 3 and above will use temporary vertex buffer objects (VBOs) whenever you use non-VBO functions, because it needs to copy your data in case you modified it in your user space code.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.