View Full Version : Display List Problems

07-28-2006, 07:24 AM
I am using Qt to display multiple OpenGL plots using Qt's QGLWidget. I originally had a class (which I call WindowOrganizer) that created 'x' amount of plots and would display them on the window in the manner I asked. I created a second class (which I call SinglePlot) that handled all of the OpenGL calls and worked with each independent plot. So my WindowOrganizer class would create multiple instances of SinglePlot objects. I would display a grid inside the plot and the corresponding x-values and y-values for the grid. This is just a 2-D plot so no z-values are used.

After working on this, it became desireable to have the x-values and y-values in secondary windows and not in the main SinglePlot window. So I created a third class called MultiplePlots which would draw three plots, the main plot with the data, a plot just to the left of this with the horizontal grid lines and their corresponding y-values, and a plot under the main plot that displayed the vertical lines and their corresponding x-values. So I changed my code so the WindowOrganizer class would now create multiple instances of MultiplePlots objects and each MultiplePlots object would create 3 instances of SinglePlot objects.

The data to be displayed in the main SinglePlot object is just the grid lines and then a line graph that I make using GL_LINE_STRIP. There are normally >20,000 points in each graph so I decided to create a display list to hold each of these so I wouldn't have to redraw each point each time I draw the plot because I can move the plot and stretch the plot. This worked fine when I had just the first 2 classes, but now that I add in the middle class, my display lists won't work.

In WindowOrganizer, I call MultiplePlots->updateGL( ) function which makes 3 separate calls to SinglePlot->updateGL( ), 1 call for each of the 3 objects. Before I make this SinglePlot->updateGL( ) call on the main window, I retrieve the objects display list and call glIsList( displayListHolder ) and it returns TRUE. The way Qt handles the updateGL call is in the QGLWidget updateGL( ) calls glDraw( ) which calls paintGL( ). Inside paintGL( ) is where I call my display list to draw as well as the grid lines. In the very first line of paintGL( ), I once again call glIsList( displayListHolder ) and this time it returns FALSE causing my plots to never draw. The grids and the grid values on the secondary plots draw correctly since their values are based on the min and max of the ortho.

Is there something that I need to do so when paintGL( ) is called, it remembers the display list is a display list? It remembered the display list was a display list when I only used 2 classes, but with the introduction of this middle, wrapper class, it seems to forget it's a display list. This seems very confusing to me. Thanks for any help you have!

07-28-2006, 09:11 AM
there is nothing to "forget" about a display list. you make a call to glCallList, the driver checks if a list with that id exists and executes it (if is exists).

maybe you create an empty list with the same id somewhere else in your code? or maybe the value of displayListHolder is changed somewhere?

07-28-2006, 11:20 AM
No, I print out the address of the GLuint I use on the display list and it is the same address and the value stays the same, but when I print out glIsList( ) it changes from True to False. This is why I am utterly confused. Thanks again

07-28-2006, 06:12 PM
I had a similar issue earlier in the year in an engine I was working on. I ended up writing a state manager class to start counting and tracking everything I was doing for debugging purposes.

I found two big problems and I don't recall which caused the problem.

1. I was calling glDeleteLists one time with an invalid list ID which some drivers definitely didn't like.

2. The other big mistake I found was that the glPushAttrib and glPopAttrib did not match (I missed one pop) which eventually led to an attributes stack overflow and the driver responded with all kinds of weird problems including invalidating some display list IDs.

Good luck.