OpenGL Vertex Buffer Object (vbo) experiment

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
VilleK
Site Admin
Posts: 2382
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

OpenGL Vertex Buffer Object (vbo) experiment

Post by VilleK »

I've made an attempt to using OpenGL Vertex Buffer Objects to render meshes in ZGE. This is supposedly the fastest way to send geometry to the graphics card.

However I get varying results. Vbo's seem to be faster. But only when I render very large geometry. With smaller meshes I get the same or even less frame rate compared to the older method using vertex arrays.

Please try the attached example (containing two exes and one zgeproj).

I render two meshes: one with 50k triangles, the other with 80k.

On my computer (nvidia card) I get the following frame rates:
40 with vbo
15 without

I'd be interested to hear what rate you get.
Attachments
vbo_test.zip
(106.55 KiB) Downloaded 571 times
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

tests,.

Post by jph_wacheski »

without vbo I get 30-29 and it runs very smoothly,. the fps alternates between 30 and 29 continuously,. every second or so,.

with vbo I get a solid 30 as long as the mouse is outside the window,. however as soon as I MOVE the mouse over the window it drops to 29 and there is that visual frame stutter,. (I remember having that same problem with ZGE in the past, I don't recall how it was resolved) if the mouse is left still while over the window the fps goes back to 30 and the visual glitch stopes,. so only while the mouse is moving,. .

hope that helps,.
iterationGAMES.com
User avatar
Kjell
Posts: 1929
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

:shock:

Huge differences .. "with VBO" versus "without VBO"

Core2Quad + Quadro = 250 vs 67
DualCore + Radeon = 168 vs 31
Pentium + Radeon = 87 vs 2
Athlon + GeForce = 37 vs 3

Laptop + Intel = 3 vs 3

K
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

lol

Post by jph_wacheski »

kjell is running a testing lab! :shock:
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2382
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: lol

Post by VilleK »

jph_wacheski wrote:kjell is running a testing lab! :shock:
Haha, indeed! :)

Good report Kjell!

Ok that means I'll leave the VBO-functionality and include it in the 1.9.6b soon. And if no problems arises we can keep it for next release.

By the way Jph, what video card do you have? Mine is a GeForce Go 7400.
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

the vidcard is a gforce 7600 GS, . .

ha! I found the vertical sync 'force off' switch in the nvida controls and it seems to have worked this time,. with that switched off I get 35-36 without, and 57-59 with, . and no mouse-moveing glitch!
iterationGAMES.com
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

49 without -> 130 with VBO :D yep quite a big difference!

Ville, before you proceed, I would ask you read this pdf: http://www.khronos.org/registry/gles/sp ... 2.0.23.pdf
It's the file speaking about the main differences between OpenGL 2.0 and OpenGL ES 2.0:
chapter 2.6-2.7. Is this VBO a major step towards a possible port of ZGE to OpenGL E.S? :) since I'm becoming quite interested in it: the Pandora handheld will only support OpenGL ES and getting ZGE working on it might be a really good thing. :P
Plus, don't forget about the IPhone :P :P :P
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
VilleK
Site Admin
Posts: 2382
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Section 2.9 "Buffer Objects" says ES supports this functionality. Also I test if VBO-functionality is present on zge-startup, if not then the old style vertex arrays are used (which is also supported in ES). So it's still backwards compatible with older graphics cards.
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Ok thank you... I got confused by vertex array and vertex buffer.

While we are on topic, what is the worst thing that has to be changed in order to get ZGE being ES-compliant? Missing fixed-pipeline functionality?
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
VilleK
Site Admin
Posts: 2382
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Well I haven't studied the ES-specification much so I can't really say.

At first I thought ES did not allow floating point values at all (only fixed point) and this would of course be a big hurdle. But now it seems like it does support floats after all. Hardware manufacturers have some freedom in what level of ES support they implement, so I'm sure there are devices that do not support floating point at all.

That spec you linked to suggests that the model of coordinate transforms using matrices with glPushMatrix etc. is not supported. But I've seen it supported in ES examples on the net, so I'm not sure what that means. ZGE use this functionality.

Immediate rendering with glBegin/End is not supported. This means that render code in ZGE apart from RenderMesh (fonts, sprites, net and particles) needs to use vertex arrays also. But this is a good idea to change in the main version of zge because it will probably increase performance in normal GL operation.
Post Reply