Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (762)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (846)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  ? VBO Performance - glDrawArrays (Mac vs PC) ?  (Read 4621 times)
0 Members and 1 Guest are viewing this topic.
Offline Z-Knight

Senior Devvie

Medals: 2

« Posted 2011-04-29 17:49:46 »

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.

Render Loop# of TrianglesMac TimePC Time

Render Loop# of TrianglesMac TimePC Time

Render Loop# of TrianglesMac TimePC Time

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.

Offline avm1979
« Reply #1 - Posted 2011-04-29 18:04:25 »

Are you updating the VBO at all after the first call, btw? I'm guessing not, and if you did you might see the same slowness every frame you update it.

I don't have a solution for you, but I did run into a similar problem using VBO on a Mac.  In my case, I was updating a small portion of it (maybe 10% or so) every frame and the performance was horrible on a Mac, and excellent on a PC. Wasn't using large VBOs (around 500 vertices), but just one of those was enough to send the frame rate from 60 into single digits.

Ended up switching to vertex arrays, which were fast enough on both Mac and PC...

Offline Z-Knight

Senior Devvie

Medals: 2

« Reply #2 - Posted 2011-04-29 18:09:56 »

thanks for the reply.

No, no updates for me. This is a 3DS graphics model and I don't change it between rendering loops.

it is good to see confirmation that others have this same issue on MACs. I guess I'll have to look into Vertex Arrays and try them - never done it before so hopefully it won't be hard.

again, thanks for the info.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline badlogicgames

« JGO Bitwise Duke »

Medals: 82
Projects: 2

« Reply #3 - Posted 2011-04-29 21:05:50 »

GPU drivers work asynchronously (for the most part). Do not time individual GL calls, the driver might do a lot more than just execute your statement (or buffer it, which is also likely).

There's probably some driver initialisation going on for your GL context. - musings on Android and Java game development
Offline Z-Knight

Senior Devvie

Medals: 2

« Reply #4 - Posted 2011-04-29 21:33:50 »

That may be true, but these timing calls still give me a little insight to what might be happening because I can definitely see the MAC version taking about 2.0 minutes to render the first call while the PC version draws almost immediately (my 3ds model has more than the 3 parts I listed in the orig post). When I put those timing calls in I helped to verify what I was noticing in person.

I do agree with your statements, thanks ... I wonder if you are right about "driver initialization", it's a good thought too.
Offline Z-Knight

Senior Devvie

Medals: 2

« Reply #5 - Posted 2011-04-29 22:10:12 »

Converted to using Vertex Arrays and it has spend up my init method and the first rendering, as well as seems to be faster for all future renderings.

I hope I'm doing the vertex arrays correctly ... it seems to be nearly identical code to VBOs where I had to create all my FloatBuffers for the vertices/normals/colors/textures but without binding them and then when I render the calls to glDrawArrays is very similar to. I think I did it right since it does render so I can't complain. Thanks for the suggestion.
Pages: [1]
  ignore  |  Print  

EgonOlsen (360 views)
2018-06-10 19:43:48

EgonOlsen (361 views)
2018-06-10 19:43:44

EgonOlsen (299 views)
2018-06-10 19:43:20

DesertCoockie (534 views)
2018-05-13 18:23:11

nelsongames (862 views)
2018-04-24 18:15:36

nelsongames (845 views)
2018-04-24 18:14:32

ivj94 (1291 views)
2018-03-24 14:47:39

ivj94 (414 views)
2018-03-24 14:46:31

ivj94 (1077 views)
2018-03-24 14:43:53

Solater (427 views)
2018-03-17 05:04:08
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!