Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (483)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (550)
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 2158 times)
0 Members and 1 Guest are viewing this topic.
Offline Z-Knight

Senior Member


Medals: 1



« 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
1100,0001731
2100,00000
3100,00000

Render Loop# of TrianglesMac TimePC Time
115,00020000
215,00000
315,00000

Render Loop# of TrianglesMac TimePC Time
16,00022500
26,00000
36,00000

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 Member


Medals: 1



« 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
« 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.

http://www.badlogicgames.com - musings on Android and Java game development
Offline Z-Knight

Senior Member


Medals: 1



« 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 Member


Medals: 1



« 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.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

CopyableCougar4 (15 views)
2014-08-22 19:31:30

atombrot (28 views)
2014-08-19 09:29:53

Tekkerue (25 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (15 views)
2014-08-16 06:20:21

Tekkerue (22 views)
2014-08-16 06:12:11

Rayexar (61 views)
2014-08-11 02:49:23

BurntPizza (39 views)
2014-08-09 21:09:32

BurntPizza (31 views)
2014-08-08 02:01:56

Norakomi (38 views)
2014-08-06 19:49:38
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!