I have a couple of performance questions related to VBO rendering using the gl.glDrawArrays(GL.GL_TRIANGLES, 0, num) call.
On a Mac OS computer I ran the exact same code using JOGL 1.1.1 and noticed that the first time my VBOs were being rendered, the glDrawArrays() call seemed to take a very large amount of time. And it didn’t seem to be proportionate to the number of triangles - e.g. I had 100,000 triangles drawn in 15 milliseconds, while 2000 triangles in another case drew in 3000 milliseconds (3 seconds). Again, this one on the very first rendering call - not the subsequent calls where the rendering time for that method reduced down to 0 milliseconds (i.e. less than a millisecond).
I noticed that this was not the case on a PC (which happens to be older and slower than the test Mac). On the PC this rendering, during the first call was tiny - in many cases less than a millisecond.
So effectively this is what timings I had…
What I’m actually rendering (using Joglutils code) is a 3DS graphics file composed of 3 objects having 100,000 triangles, 15,000 triangles and 6,000 triangles.
[tr]
[td]Render Loop[/td]
[td]# of Triangles[/td]
[td]Mac Time[/td]
[td]PC Time[/td]
[/tr]
[tr]
[td]1[/td]
[td]100,000[/td]
[td]17[/td]
[td]31[/td]
[/tr]
[tr]
[td]2[/td]
[td]100,000[/td]
[td]0[/td]
[td]0[/td]
[/tr]
[tr]
[td]3[/td]
[td]100,000[/td]
[td]0[/td]
[td]0[/td]
[/tr]
[tr]
[td]Render Loop[/td]
[td]# of Triangles[/td]
[td]Mac Time[/td]
[td]PC Time[/td]
[/tr]
[tr]
[td]1[/td]
[td]15,000[/td]
[td]2000[/td]
[td]0[/td]
[/tr]
[tr]
[td]2[/td]
[td]15,000[/td]
[td]0[/td]
[td]0[/td]
[/tr]
[tr]
[td]3[/td]
[td]15,000[/td]
[td]0[/td]
[td]0[/td]
[/tr]
[tr]
[td]Render Loop[/td]
[td]# of Triangles[/td]
[td]Mac Time[/td]
[td]PC Time[/td]
[/tr]
[tr]
[td]1[/td]
[td]6,000[/td]
[td]2250[/td]
[td]0[/td]
[/tr]
[tr]
[td]2[/td]
[td]6,000[/td]
[td]0[/td]
[td]0[/td]
[/tr]
[tr]
[td]3[/td]
[td]6,000[/td]
[td]0[/td]
[td]0[/td]
[/tr]
As you can see, there appears to be no correlation between the # of triangles and the initiation time - ie the first rendering time. I mean, for 100,000 triangles the MAC time was only 17 milliseconds while for 15,000 triangles it was 2000 milliseconds. And on the PC side the timings are not even close to the MAC times in most cases.
I can probably understand why the first draw method has this issue and it likely has to do with the first time this is being rendered to the graphics card - ok, fine. Does that sound reasonable?
The other question (and probably my main issue) is why is the MAC first rendering soooooooo much more than the PC? Do you think the MAC JOGL implementation is not as robust as the PC one? Trust me when I say the MAC I was running on is far superior to the PC yet the first rendering loop is so long that I think that the program is dead when it runs on the MAC.