What is the meaning of glEnableClientState
and glDisableClientState
in OpenGL?
So far I've found that these functions are to enable or disable some client side capabilities.
Well, what exactly is the client or server here? I am running my OpenGL program on a PC, so what is this referring to? Why do we even need to disable certain capabilities? ...and more intriguing it's about some sort of an array related thing?
The whole picture is very gray to me.
The original terminology stems from the X11 notation, where the server is the actual graphics display system:
and
glEnableClientState
and glDisableClientState
set state of the client side part. Vertex Arrays used to be located in the client process memory, so drawing using vertex arrays was a client local process.
Today we have Buffer Objects, that place the data in server memory, rendering the whole client side terminology of vertex arrays counterintuitive. It would make sense to discard client states and enable/disable vertex arrays through the usual glEnable
/glDisable
functions, like we do with framebuffer objects and textures.
If you draw your graphics by passing buffers to OpenGL (glVertexPointer(), etc) instead of direct calls (glVertex3f()), you need to tell OpenGL which buffers to use.
So instead of calling glVertex and glNormal, you'd create buffers, bind them, and use glVertexPointer and glNormalPointer to point OpenGL at your data. Afterwards a call to glDrawElements (or the like) will use those buffers to do the drawing. However, one other required step is to tell the OpenGL driver which buffers you actually want to use, which is there glEnableClientState() comes in.
This is all very hand-wavy. You need to read up on vertex buffer objects and try them out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With