Display list question

in a seperate function I have this

List = glGenLists(1);
glNewList(List, GL_COMPILE);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, VertexData);
glDrawElements(GL_LINE_LOOP, size_of_poly, GL_UNSIGNED_INT, FaceData);
glEndList();

then in my display function I have this

glClear(GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT);
glShadeModel(GL_SMOOTH);

glPushMatrix();
glRotatef(spin_x, 0.0, 1.0, 0.0);
glRotatef(spin_y, 1.0, 0.0, 0.0);
glCallList(List);
glPopMatrix();

cout<<gluErrorString(glGetError())<<endl;

glutSwapBuffers();

Why am I getting the error invalid value. I know where I’m getting the error. Its comming from glCallList(List);

Hi !

Please notice the following from the glNewList documentation:

Certain commands are not compiled into the display list, but are executed immediately, regardless of the display list mode. These commands are glColorPointer, glDeleteLists, glDisableClientState, glEdgeFlagPointer, glEnableClientState, glFeedbackBuffer, glFinish, glFlush, glGenLists, glIndexPointer, glInterleavedArrays, glIsEnabled, glIsList, glNormalPointer, glPopClientAttrib, glPixelStore, glPushClientAttrib, glReadPixels, glRenderMode, glSelectBuffer, glTexCoordPointer, glVertexPointer, and all of the glGet routines.

Mikael

ok thanks thats what I figured

Even though the vertex array commands are not stored in the display list, you can still build a display list from a vertex array. When compiling the display list, vertex arrays are dereferenced as if they are drawn, and moved into the display list. So there’s nothing wrong with your display list on that part.

Are you making sure you create the list after you have a rendering context created?