sheesh...finally found a site where I can upload my source code example - all others were blocked by my lovely work spy-on-your-employees system.
Here is the link to the JOGL version 1.1.1 example: http://www.nippyzip.com/uploads/111004013618-16435.zip
- that should be good for 3 days.
I included a 3DS example file called "Gantry.3ds" and my source code that includes helper classes (JOGUTILS 3DS loader stuff) and my modified Viewer and Renderer. This file is comprised of about 700 objects, 174000 vertices and 177000 faces.
Copy all the files into one project folder and copy the Gantry.3ds file to some directory and note the path. Then edit the 'Dumb3DSViewer.java (line 87) and set the path to this model in that location.
To run the program you run the 'Dumb3DSViewer.java' class. When it starts it will show a blank 3D scene with only the colored 3D axes. You can use the mouse to do some crappy rotation. Since I don't use an FPSAnimator, the updates to the scene occur as a result to changes in the view - so when you move your mouse to rotate the scene then stuff gets updated. So keep that in mind because you will have to do some rotations while the model is loading to see the issue that I am seeing.
Ok, so, when you run the program (Dumb3DSViewer) scene is empty...so hit the 'Z' keyboard key to load the 3DS model in the background. While that is loading make sure that you are rotating the scene (the 3D axes) around so you can see the updates occurring. While you are doing your mouse rotation you will notice a period during which time you will lose control and nothing will update - probably like 3-4 seconds later the update will finish and the model will be displayed and you will be able to continue rotating.
If you go into the 'Dumb3DSRenderer.java' (line 287) there will be the glColor3d(1.0, 1.0, 1.0) call that you can comment out and repeat the process. With this line commented out the 3DS model will load super fast and display almost immediately...I mean you probably have to be moving the mouse around before you hit the 'Z' key to load the model so you can see the effect.
So...you might be wondering if my loader is the cause or the way I load by using a separate thread to spawn the loading in the background. Sure, I thought about that, but if the separate thread was the cause then I should see that same issue irrespective of having the extra glColor3d() call or not. I think this has something to do with the way I'm rendering or creating display lists - I don't know.
I did figure out one thing though - the 3DS model has a lot to do with it and not so much how many vertices or faces it has but rather how many objects it has. The model, Gantry.3ds, only has 700 objects but my work models have about 4700 and if you notice the rendering loop (drawImmediateMode() method on line 278 of Dumb3DSRenderer) I loop over the objects. I used models with more vertices and faces but only like 10-20 objects and the scene was generated super fast....so that kind of confused me as to what is going on.
So having 4700 objects means I loop a lot and have many calls to glColor3d() - but it is necessary because each object could have a different color/material/texture so I can just have one global color call. Note in this example I am only using one color just for testing purposes but the full code has the specific color/material/texture calls for that object.
I hope that is all clear - I know it is kind of wordy.
P.S. For grins and to blow your mind even more, move the gl.glColor3d(1.0, 1.0, 1.0) from the drawImmediateMode() method in Dumb3DSRenderer.java from outside of the glBegin(GL_TRIANGLES)/glEnd() to inside that loop and notice what happens. Tell me it is not confusing that simply moving that call inside the glBegin/glEnd block speeds it up!?! But at the same time, if I try to add a glEnable(GL_COLOR_MATERIAL) call inside or outside the glBegin/glEnd block the slowdown is the same. Hence my crazy situation - I don't know what is going on. And if anyone does I would be eternally thankful - or for at least a couple of weeks.