I am about to bash my head into this monitor because I cannot figure out the cause, the source or the solution to a very weird rendering problem. I’m trying to work on a simple version to demonstrate the issue but in the meantime here is my problem.
I am working on rendering a 3DS model. I am able to read in the model quickly enough and then I try to render it and this is where I get the weird results. I have two ways of rendering: Immediate Mode and Display Lists. The Immediate mode rendering has no problems, other than it is a bit slow if I have large models. The Display Lists mode is essentially created using:
This is essentially my Immediate Mode rendering code (psuedo code):
When I render I simply do the following:
So here is where it gets weird. I put timing statements all over the place to measure how long something takes to complete. The loading of the model is tiny. The rendering in immediate mode is tiny. The creating of the display lists is tiny. Calling glCallList() on the list is tiny.
BUT…upon the first rendering my updates get blocked for a period of time that is proportional to the size of the 3DS model only if I include the RED section above…for some reason calling any of those methods, and others as well causes a massive slow down that takes control of my update and does not return it for a few seconds. Effectively the time between the end of the first display() call and the start of the next display() call is delayed by the few seconds.
I have NO IDEA why this is happening…I can take out those glColor3d() or glDisable() calls and it is fine. I can put in a glIsEnabled() call and it is fine too but certain gl calls cause my slowdown. I can’t understand what is happening here at all. I realize the first time you send something to the graphics card via a display list invocation that things can be slow…but in my case the display list is only bad/slow when those extra commands are sent and those can be in a display list - as far as I’m aware.
I don’t know if this is an OpenGL question or a JOGL question…btw, I control my display updates using the display() call on my GLJPanel, but somehow this issue is preventing from making any updates…I essentially lose all listener control, the long pause occurs and then I get them all back and the scene continues to render without any problems…only that first one is an issue.