Jump to content
  • Advertisement
Sign in to follow this  
keo

Impossible thing with VBO ?

This topic is 3802 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 All, To simplify the problem : I have a static VBO, which contains 1024 x 1024 vertices that I load at the launch of my program. In each frame, I use only a few of these vertices, let's say 16, by using an index array (so 16 indices). The problem is : my texture coordinates must change in each frame for these 16 vertices. Is there a way to upload to the graphic card only 16 texture coordinates for these 16 vertices, or am I obliged to upload all the new 1024 x 1024 texture coordinates in each frame ? Kéo

Share this post


Link to post
Share on other sites
Advertisement
Is this what you want?
glBufferSubData

Note that this isn't precisely performance-friendly... but if you do it once per frame, it should be ok.

If you are able to predict your groups and can add some kind of index number to your vertices, you could also set 16 texture coordinates by changing the state with good old glTexCoord (like you would in immediate mode). That way, each of your 16 vertices would have 16 texture coordinates, but now the difficulty is figuring out which one to use for each vertex (a vertex doesn't know its index). So, you would have to know which vertex in each 16-group will have which index, add that to the vertex data, and forward the corresponding texcoord as varying in the vertex shader. If you pick pretty much random vertices, this isn't possible.
Also, all in all, it will be quite difficult, and it's probably a lot cheaper and less error-prone to just upload new data with glBufferSubData.

Share this post


Link to post
Share on other sites
VBO isn't reliable in my opinion. I usually end up building my own vertex buffers since I'm a console developer. What I do is that I build a file with every vertex on the screen then load it into the engine. Afterwards I have a culling algorithm that'll go through the base vertex list and create a draw list that is rendered. You can't load a draw list before the render pump and modify it, you have to calculate what's to be drawn right before it's drawn then draw it.

Share this post


Link to post
Share on other sites
Quote:
Original post by TheDirector
VBO isn't reliable in my opinion. [...] I build a file with every vertex on the screen then load it into the engine. Afterwards I have a culling algorithm that'll go through the base vertex list and create a draw list that is rendered.
You're joking, right?

Share this post


Link to post
Share on other sites
Thank you all FoxHunter2, samoth, The director ! I've finally found a way to calculate my texture coordinates in the vertex shader ! :-))

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!