public void glDeleteDisplayList( GL gl ) {
if (displayList != 0) {
gl.glDeleteLists( displayList, 1 );
displayList = 0;
}
}
This code will cause an OutOfMemoryError for a valid display list number.
The only hit as to what is going on, is that I call canvas.getGL() outside of the display method of GLEventListener.
If I call the above method from inside display then it works.
Why is this?
When a user wants to load a new 3D scene I need to clear all the display lists being used, and I don’t want to do this inside the GLEventListener class, since that doesn’t make sense.