Display list question

I have a display list that is initiated in the init() method.
The method that the display list calls need two parameters but I get the values to these parameters after the init() method has initiated the display list.

Is is possible to change the values later or is the only way around this to create the display list outside the init() method?

create the display list outside the init()

Ok, but if put the below lines of code in a listener method that is called each time the user press a button, the list is redeclared.
Maybe it doesn´t matter? Or do I loose the advantages of display lists if I redeclare it over and over again?

// Init display lists
quad = gl.glGenLists(1);
gl.glNewList(quad, GL.GL_COMPILE);
   drawQuads(gl);
gl.glEndList();

Only recompile if parameters changed then.

How do I recompile?

The only way of recompiling I know is actually to redeclare the whole display list. Or is there any other way of doing this?

quad = gl.glGenLists(1);
gl.glNewList(quad, GL.GL_COMPILE);
   drawQuads(gl);
gl.glEndList();

Apart from the fact that display lists are deprecated, although I am sure Mark Killgard will drop from the sky in a minute clutching a flaming pitchfork and try to tell you otherwise, there are far better ways to do what you are doing.

The thing is you are getting to the point where you need to use other methods so why stick yourself with the extra problem of having to conditionally reconstruct Display Lists, and keep using a subset of OpenGL which is potentially not portable in the future?

Having said that, you can do this… GL_COMPILE_AND_EXECUTE, or GL_COMPILE or just GL_EXECUTE on a display list…

So why not in your main loop check to see if the display list needs to be refactord and if so call the code to init it but init the display list with COMPILE_AND_EXECUTE.

Otherwise just use the existing display list with GL_EXECUTE.

i.e:

if(display list is no longer valid) initWithCompileAndExecute()
else gl.glCallList(n);