Skip to main content
gamedev.net
🔒 Locked

Performance breakdown when using VBO's

Started by DerAndiY May 5, 2004 at 11:11 PM 10 replies 600+ views
Original Post
DerAndiY
DerAndiY
Hi, I''ve just started experimenting with VBO''s. Therefore I downloaded and compiled nehe''s tutorial on vbo''s ( http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=45 ). Experimenting with the mesh parameters #define MESH_RESOLUTION 1.0f // Pixels Per Vertex #define MESH_HEIGHTSCALE 1.0f // Mesh Height Scale lead to a scene with app. 500000 triangles. Surprisingly the scene is rendered at 2FPS when VBO ist turned on but 12 FPS when VBO is turned off. At lower triangles per scene the VBO''s are much faster. Any ideas what could have happened?? Cheers Andi
Ostsol
Ostsol
What kind of video card do you have?
-Ostsol
DerAndiY
DerAndiY
A Geforce4MX AGP8x
Ostsol
Ostsol
That''s odd. . . That card supports VBOs. . . Might be a driver bug, though I''m really not sure.
-Ostsol
Trienco
Trienco
vbo is behaving strange sometimes and all the all the wonderful combinations of card and driver and code could probably fill a whole book ,-)
if lower counts are much faster you could probably try two things. split the geometry up into a few smaller single vbos and/or use drawrangelements (if not already doing so). maybe you simply dont have enough free video memory and whatever its falling back to is less efficient than vertex arrays (though that would be kind of weird).
or, make sure its not different buffers for different attributes. if you have a bad day part of the buffers are in video memory and part in system memory. using streams in different kinds of memory might screw up your performance pretty good.
f@dzhttp://festini.device-zero.de
Fingers_
Fingers_
I looked at that NeHe tutorial; it''s not the most efficient method to display large heightmaps.

As Trienco guessed, the code uses separate buffers for vertex/texture coordinates. You should interleave them instead.

Also, it makes 6 unique vertices per quad so it''s likely to run out of VRAM sooner than you''d expect. Using a triangle strip would save a lot of memory here, and indexed vertices would be even better (roughly 1/6 memory usage for verts).
Ostsol
Ostsol
Eck. . . Yeah, definitely an ugly sounding implementation.

How much video RAM does that Geforce 4 MX have?
-Ostsol
DerAndiY
DerAndiY
Thanks for your helpful replies guys. I should tweak the code a bit. How can I interleave the vertex/texture coordinates? I don''t quite get it.
Cheers
Andi
_the_phantom_
_the_phantom_
by interleave they mean make it so that the vertex coordinates follow the texture coordinates in memory (I think thats the right order of access anyways), normaly done with a struct looking something like

struct vertex
{
float u,v;
float x,y,z;
};


then when you generate your vertex/texture coords you place the details for each in that structure.
When rendering you use the 'stride' parameter to skip the data you dont need.

[edited by - _the_phantom_ on May 9, 2004 11:55:40 PM]
DerAndiY
DerAndiY
Ah, thanks for helping out a newbie. I''ll rewrite nehe''s code and post you the results. I assume you draw the buffers by using gldrawelements...
Cheers
Andi
Ostsol
Ostsol
glDrawRangeElements is apparently much easier for the driver to optimize for.
-Ostsol
_the_phantom_
_the_phantom_
correct, it is because you give them more infomation on the data set you''ll be using.

Also, while it might not be important atm, keep in mind that AGP based cards (and probably holding true for PCI-Express) transfer data across the base in multiples of 32bytes, so if you can get the data per-vertex to be at that size you''ll help the card even more.
As i said, not really applicaible here, but its one of those things that might be handy to know later



[Phantom Web | OpenGL Window Framework ]
"i wonder why i do that... type words which are nuffin like the word i wanted every now and badger"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.