Contents / Previous / Next


Step 1: Enable Vertex Arrays

glEnableClientState() with an enumerated parameter, activates the chosen array:
  void glEnableClientState( GLenum array )

   acceptable parameters are:

    GL_VERTEX_ARRAY
    GL_COLOR_ARRAY 
    GL_INDEX_ARRAY 
    GL_NORMAL_ARRAY 
    GL_TEXTURE_COORD_ARRAY
    GL_EDGE_FLAG_ARRAY
In theory, you may need to call this up to six times to activate the six available arrays. In practice, you'll probably activate only between one to four arrays.

For example, if you use lighting, you may want to define a surface normal for every vertex, you do the following:

 glEnableClientState(GL_NORMAL_ARRAY);
 glEnableClientState(GL_VERTEX_ARRAY);
Suppose that you want to turn off lighting at some point and also want to stop specifying values of the surface normal, you call:
  glDisableClientState( GL_NORMAL_ARRAY );

The client side

You might be asking yourself why the architects of OpenGL created these new command names, gl*ClientState(). Why can't you just call glEnable() and glDisable()?

The reason is the array data remains on the client's side (the client's address space) in the Opengl client-server model.
On a singel PC the client is the host CPU and Main-Memory, the server is the graphics hardware.
During rendering the data is transferred to the server's address space (the graphics hardware).

One consequence is that the specification of vertex arrays cannot be stored in a display list, which reside on the server side.