automatic recreation of display lists

Dear All,

I my program, I am rendering some static stuff using display lists with something like:

void renderStaticStuff()
{
if(!displayList)
create and execute display list;
else
execute display list;
}

void displayCallback()
{
glPushMatrix();
transformations;
renderStaticStuff();
glPopMatrix();
}

void init()
{
initialize and setup the application;

//call renderStaticStuff(); so that
//display lists will be created while
//setting up and will not cause a delay
//during actual 1st rendering
renderStaticStuff();
}

Now the problem is the display lists are getting created while setting up the app, i.e. as a response to the call from init()

But, they are again created when the static stuff is rendered for the first time.in display callback. (For further rendering calls it works fine, i.e. the lists are excuted and not created everytime.)

Why the system is creating them again, even if they are already created.

Thanks,

  • Chetan

This can not be answered given your pseudo code.
Standard errors are:
Because init() has no OpenGL context current when you issue the display list build commands?
Because you forgot to set “displayList” after the first init?

Thanks for the reply.

Actually they were getting deleted in my code it self.

So, never mind…:stuck_out_tongue:

  • Chetan