Jump to content
  • Advertisement
Sign in to follow this  
Decrius

VBO's and texture bindings

This topic is 3408 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

Hey, yes another VBO question :-) I am reading much about VBO's lately and came across this question: Do VBO's also allow you to bind texture's per vertex? Since, AFAIK, we can send vertex positions, colours, texture coordinates, etc. but I haven't come across an example showing me how I can also send texture-bind information to the GPU. For example, I draw a 3D box, each side having a different texture. Would I need to call a VBO for each side of the box?

Share this post


Link to post
Share on other sites
Advertisement
In short; you can't.

A VBO is simply a list of geometry information nothing more. A texture on each side of a box is a purely artifical case which won't occur in a real game , you are more likely to unwrap the mesh and just apply one texture over it, which from a performance point of view is much better as texture swaps are expensive.

If you are just testing however then, yes, you will need to issue a draw call for each side having change the texture in between, which will involve either having more than one VBO or having the data in the one VBO and just referencing it at a different offset for each draw call to get the correct vertex information.

Share this post


Link to post
Share on other sites
Quote:
Original post by phantom
In short; you can't.

A VBO is simply a list of geometry information nothing more. A texture on each side of a box is a purely artifical case which won't occur in a real game , you are more likely to unwrap the mesh and just apply one texture over it, which from a performance point of view is much better as texture swaps are expensive.

If you are just testing however then, yes, you will need to issue a draw call for each side having change the texture in between, which will involve either having more than one VBO or having the data in the one VBO and just referencing it at a different offset for each draw call to get the correct vertex information.


Thanks, texture wrapping gave me some new idea's! Also sounds quite reasonable why it's not included as a feature...if texture binding is expensive.

Share this post


Link to post
Share on other sites
there is a way you can draw more textures on a simple mesh.
I did it by using GLSL and by binding a new vertex attribute variable called materialID. In my fragment shader I then check the vertex id and choose appropratie sampler to sample from, that's all.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!