Jump to content
  • Advertisement
Sign in to follow this  
Laval B

OpenGL Managing VBOs

This topic is 3037 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone.

I have a couple of newbie questions. I'm currently working on implementing some spatial partitioning for static objects in a scene (dynamic objects will be next step). I have read all of Yann Lombard's posts on the subject as well as most of those that derrived from them. I will be using ABT wich, as long as static geometry is concerned, is rather straightforwad to implement.
Anyway, i have a question about OpenGL itself. I have read that texture management with OpenGL is rather trivial. You just send everything to the implementation and let it manage it. Of course, compress textures and profile to keep everything under control.

My questions are :

1. are we doing the same with VBOs ? (my guess is no) For example, i'll end up with some index lists in the leaves of my ABT and use glDrawElement to render the visible ones. But how should i send the actual geometry to the implementation ? One big VBO, many smaller VBOs ...

2. When using indices, i assume that the video card will transform and render only the geometry designated by those indices even if there are more vertices in the bound VBO. Am i correct ?

3. Is it the same with Direct3D api ?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
For example, i'll end up with some index lists in the leaves of my ABT and use glDrawElement to render the visible ones.


With spatial partitioning you do culling in model level, not triangle-vertex level. Then you do backface culling (which is done by the gpu itself). Then occlusion and after all LOD because all the above except for LOD are done in model level.

Quote:
One big VBO, many smaller VBOs


one big is better or you can add submeshes into a mesh and render vbos for submeshes (thats how I do it)

2. Yes

3. Yes

Share this post


Link to post
Share on other sites
I remember reading that nVidia recommended 1 to 4 MB as VBO size, not sure what year that was though. If you make the VBO too big, the OpenGL driver might refuse to put it into video memory.

Share this post


Link to post
Share on other sites
Thank you for the answers.

So, once i made sure that my VBOs all have a size that is within optimal range for the hardware, i should send them all to the graphics card ? That might be alot ...

Share this post


Link to post
Share on other sites
You create some VBOs, then you repeatedly bind them, buffer data into them and call glDrawElements or glDrawRangeElements. Ideally you will not buffer all data every frame but only the parts that change. The driver will take care about uploading whatever it needs to the graphics card.

nVidia has a white paper about using VBOs (which looks like it's the original VBO extension spec). It's a bit old so it has some deprecated functions in it (today you should use glVertexAttribPointer since glColorPointer etc are now deprecated), but it explains what the various functions are for and what they do internally so it should answer some of your questions.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!