I'm creating a game in gl4java, and I am trying to make use of display lists because there are several large models in use. The GLAnimCanvas, when the program starts, is not visible; it's actually part of a tabbed panel, and the *other* tab is visible from the start (it's a 2D representation of the screen, using something other than OpenGL). Even though I call canvas.start() when the program loads, none of the init/preInit/display functions are called because it is not visible, only when I switch to the OpenGL tab do these functions get called for the first time (but on subsequent tab changes, they do not get called again-- just once).
My problem: On the 2D side, I place my objects (planes, tanks, etc.), and then I have the ability to view them in the OpenGL side. Any objects I place *before* I go to the 3D side for the first time seem to work fine. The first time they are rendered, I check to see if the display list has been compiled, if so I render (glCallList), if not, i compile. However, if I go to the 3D side, and then choose to place a model on the 2D side that i haven't yet placed, when I go back to the 3D (opengl) side, they do not show up, however the display list *is* compiled and the glCallList call *is* executed. It's almost as if after a few calls to display() that any display list compiled is not valid: if i place an object before display() is ever called, then it will be compiled on the *very first* call to display and will consequently render properly; if, however, i switch to the 3D side (therefore causing display() to be called many times) and *then* compile display lists, they don't show up.
Any ideas? I'm not exactly sure what glGenLists() does; could this have something to do with it?