PDA

View Full Version : Vexing display list problem



Tokage
09-08-2006, 09:04 PM
I'm working on an application in which I need to, on occasion, create a new display list with vertices that are determined at run-time from GLU's tesselation library. Every time such a list needs to be created, my program does this:

dispList = glGenLists(1);

glNewList(dispList, GL_COMPILE);
gluTessBeginPolygon(tess, NULL);
gluTessBeginContour(tess);
// ... multiple calls to gluTessVertex() ...
gluTessEndContour(tess);
gluTessEndPolygon(tess);
glEndList();And it works exactly once. The first time this function is called, everything happens beautifully, but every time after that, it fails. The commands in the display list simply are not executed. I tried replacing the tesselator code with just code to just draw one triangle, and the same thing happens: it works, but only once. I discovered in the debugging process that the first time, glGenLists() returns 769, but every time after that it returns 3. I don't know if this is significant, but I thought I should mention it.

Anyway, does anyone have any idea what's going on here? Any help at all would be appreciated. Thanks.

09-08-2006, 09:18 PM
Are you sure you're doing glCallList() on the right list each time, and not just repeating the first one?

Tokage
09-08-2006, 09:36 PM
Yes, I'm sure. dispList is a private data member of a class, and the function containing the code I posted is called only once for each instance of the class. glCallList(dispList) is also called in a member function, so there's no way it could be getting the wrong list.