Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (707)
Games in Android Showcase (207)
games submitted by our members
Games in WIP (781)
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 3470 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  
You cannot reply to this message, because it is very, very old.

Galdo (350 views)
2017-01-12 13:44:09

Archive (507 views)
2017-01-02 05:31:41

0AndrewShepherd0 (971 views)
2016-12-16 03:58:39

0AndrewShepherd0 (908 views)
2016-12-15 21:50:57

Lunch (1040 views)
2016-12-06 16:01:40

ral0r2 (1274 views)
2016-11-23 16:08:26

ClaasJG (1370 views)
2016-11-10 17:36:32

CoffeeChemist (1374 views)
2016-11-05 00:46:53

jay4842 (1459 views)
2016-11-01 19:04:52

theagentd (1240 views)
2016-10-24 17:51:53
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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!