View Full Version : glEnableClientState(GL_VERTEX_ARRAY)
10-01-2011, 03:25 AM
I've wondered for a while why this "state" even exists. Is there any reason not to enable this state forever and never disable it?
10-01-2011, 04:32 AM
Probably for consistency.
10-01-2011, 04:19 PM
Ok, so the GL_VERTEX_ARRAY client state is nonsense, given that it won't even apply unless I am calling glDrawArrays or glDrawElements, etc., and you MUST have vertices for the call to even make sense. The other client states are useful like GL_NORMAL_ARRAY, GL_COLOR_ARRAY, etc., correct?
My understanding then is, it's fine to just enable GL_VERTEX_ARRAY in your one-time context initialization and from then on just omit all the glEnableClientState(GL_VERTEX_ARRAY)/glDisableClientState(GL_VERTEX_ARRAY) calls that you would have made, correct?
I am in the process of converting all my vertex array stuff to use GL_ARB_vertex_array_object. If I use that, can I forget about all the legacy vertex array client state stuff? In other words, if I have a bound vertex array object, and I do glInterleavedArrays or gl*Pointer calls, it will do the right thing in the vertex array object context without having to worry about gl(En/Dis)ableClientState?
10-01-2011, 07:10 PM
Ok, so the GL_VERTEX_ARRAY client state is nonsense, given that it won't even apply unless I am calling glDrawArrays or glDrawElements, etc.
That's not true. You can always use `glArrayElement` in immediate mode, between `glBegin/glEnd` calls.
I mean, not that anyone ever should. But thanks to this function, it is certainly possible to pull some attributes from glArrayElement and still use `glVertex` to provide the positions.
I am in the process of converting all my vertex array stuff to use GL_ARB_vertex_array_object. If I use that, can I forget about all the legacy vertex array client state stuff?
No. Not unless you're also using glVertexAttribPointer exclusively. No glVertex/Color/Normal/etcPointer calls. And even then, you still have glEnable/DisableVertexAttribPointer to deal with.
10-02-2011, 05:57 PM
Ah ok, that answers my question. Thanks so much for the responses!
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.