Jump to content
  • Advertisement
Sign in to follow this  
Jacob Roman

[DirectX8] Vertex Buffers

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

Is it ok to use one Vertex Buffer per polygon, or will it have an impact on performance? Also, I think it's impossible to have more than one texture per Vertex Buffer. Am I right or wrong?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Jacob Roman
Is it ok to use one Vertex Buffer per polygon, or will it have an impact on performance?

Also, I think it's impossible to have more than one texture per Vertex Buffer. Am I right or wrong?


Creating one vertex buffer per polygon is a big waste of memory and performance. When you switch to a different stream the GPU has to make adjustments so a better idea is to put similar polygons(like all the ones from one model) into one VB. Even if the VB contains more than one polygon you could still draw them one by one, but that won't be very fast.

Textures and vertex buffers are two different interfaces. Neither one is dependant on the other. You could use only one VB but still render hundreds of polygons with different textures.

Say we have a model of 200 polygons using four textures. The polygons have been sorted based on the texture.

- Set stream source to VB with 200 polygons.
- Apply texture 0
- Render all the polygons with texture 0
- Apply texture 1
- Render all the polygons with texture 1
- Apply texture 2
- Render all the polygons with texture 2
- Apply texture 3
- Render all the polygons with texture 3

You can actually apply up to 8 textures to one poly depending on your video card.

Share this post


Link to post
Share on other sites
A polygon? Like a triangle? No it wont be acceptable. You generally want alot of verts in a buffer, thousands. The overhead cost on switching buffers will overcome yer game in no time. This help? heh

Share this post


Link to post
Share on other sites
Yeah the reason I asked is because I was only able to use only one texture every time I use a Vertex Buffer. How many is too many though? Is one enough?

Share this post


Link to post
Share on other sites
Quote:
Original post by Jacob Roman
Yeah the reason I asked is because I was only able to use only one texture every time I use a Vertex Buffer. How many is too many though? Is one enough?


Many is thousands per buffer, find whats best for you, its an endless debate. As far as the texture, you can use tons of textures at once. Are you using shaders? Its actually pretty easy and multiple ways to use many textures at once.

I would advise you to pickup some info on shader programming(although I suck at it still.) Im still learning how to write them, but I can tell ya so far its the easiest for me to understand how to manipulate them, wether its combining them and putting weights to each one or what not.

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!