Display list initialization

I have written a parser for ASCII files and
the information is to be stored in a display
list. However, when the time comes to
define the display list’s attributes glGenLists(1) returns 0. I have declared a variable of type GLint to accept the value returned by glGenLists. I can’t figure out why it is always returning 0. I am coding in Visual C++ 6.0, and using glut routines. I don’t think either has anything to do with this. Thoughts anyone? Thanks.

Check your glError states. You can’t call glGenLists between a glBegin and a glEnd.

That isn’t the problem. I don’t have any declarations to glGenLists() between glBegin() and glEnd(). Thanks

I think it may be a problem of rendering context. When applying for a list index, you must make sure that the current openGL rendering context and the window device context be valid. Did you put your code before openGL being set up?

Originally posted by yargerb:
I have written a parser for ASCII files and
the information is to be stored in a display
list. However, when the time comes to
define the display list’s attributes glGenLists(1) returns 0. I have declared a variable of type GLint to accept the value returned by glGenLists. I can’t figure out why it is always returning 0. I am coding in Visual C++ 6.0, and using glut routines. I don’t think either has anything to do with this. Thoughts anyone? Thanks.

Thank you! That was it. I appreciate the help!