Hi there. I’m having a problem with glGenLists and glIsList. I have a program that creates a grid with a user defined x and y. It generates a list to display the grid. That works fine the first time, but it fails if I try to delete the first list and create a new one. It simply displays the original list.

I have a GLuint defined as a global. I get a list id using “grid=glGenLists(1)” and then create it with “glNewList(grid,GL_COMPILE)”. This works fine and I get a display list id of “1”. The next time I initiate the grid, I try to do a “if(glIsList(grid)) glDeleteLists(grid,1)”. First of all, the glIsList never returns a value other than 0 (if I set it equal to a GLuint or ‘’ if I set it equal to a GLboolean). Second, since the glDeleteLists is skipped, I get successive glGenLists(1) calls. So it should return something other than 1 since that’s what I used the previous time, right? Nope, I get 1 every time… :stuck_out_tongue:

Am I missing something here?


Hi !

According to what you describe, there shouldn’t be any problem…

So you should post your code in the forum so that we can have a closer look : there must be a mistake somewhere !

Just a question : are you sure your rendering context is current (wglMakeCurrent) when you call glIsList and glDeleteLists ?


Ah-ha! Thank you Eric, you hit the nail on the head.

Since I have a dialog to enter the new map coordinates, I have to do a glutSetWindow() before calling glIsList and recreating the display list…