• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Display lists suck

## 4 posts in this topic

Hey, Im having some problems getting my display lists working. The problem lies in the call to glGenList() i think. At least the msg box pops up when i run the function CreateDisplayList()
 ` class MS3DModel { private: Mesh *MeshList; Material *MaterialList; int numVertices, numMeshes, numNormals, numTriangles, numMaterials; public: GLuint listthingy; MS3DModel(); MS3DModel(char *filename); ~MS3DModel(); bool LoadFromFile(char *filename); void Print(); // for debugging void Render(); void CreateDisplayList(); void RenderFromDisplayList(); }; void MS3DModel::CreateDisplayList() { listthingy = glGenLists(1); if (listthingy == 0) { MessageBox(NULL,"FUCK!!","ERROR",MB_OK|MB_ICONEXCLAMATION); } glNewList(listthingy, GL_COMPILE); glBegin(GL_TRIANGLE_STRIP); for (int m=0; m
I got another function called Render() which has pretty much the same code as CreateDisplayList() except the list commands ofcourse, and that function works like a charm. BTW glGenLists() return 0 if an error occurs. Can figure out what goes wrong though. Hope you can help me out. Thanks in advance Edited by - newdeal on July 12, 2001 7:17:14 PM
0

##### Share on other sites
Well, just found this in some developers journal. Too bad i have no clue what the guy''s saying . Maybe you do.

quote:

"Well, that certainly sucked. Just spent the last two days tracking down why glGenLists() kept returning 0 and all display lists weren''t working. I came to the conclusion that it had to do with GL context init - the ortho views share the same display lists as the perspective view, but they are created before the context is initialized. Theoretically, it was Qt''s fault. I''ve got to organize the GL stuff, though."

0

##### Share on other sites
The first place to look is glGetError(). If the return value of glGetError() == GL_NO_ERROR, then you''re really going to have fun . There are only a few errors defined in OpenGL, and some of them, such as GL_STACK_OVERFLOW, have no effect on the program other than to set the error flag. Check out the Blue Book for a complete list of the error defines (or gl.h).
0

##### Share on other sites
There are 2 things that I would make sure of. First make sure that you are generating your lists AFTER you initialize OpenGL. And make sure that you are not calling glBegin before generating the display list. Either of those situations would cause glGenLists to fail and return GL_INVALID_OPERATION from glGetError.

Seeya
Krippy
0

##### Share on other sites
Problem solved! I was creating the lists before OpenGL was properly initialized.

Thanks guys
0