🔒 Locked
Performance breakdown when using VBO's
Advertisement
Original Post
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
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.
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.
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).
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).
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
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]
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]
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"
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.
Advertisement