Jump to content
  • Advertisement
Sign in to follow this  
guvidu

index VBO with 2 index array ? is that posible?

This topic is 3787 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 there Im having trouble rendering my object with index VBO. I use the 3ds max importer from gameTutorials class (if any one knows that). The problem im facing is like this. i have this arrays vertexes Normals texturesUV Problem lays in the fact that texturesUV and vertexes have different indexes. So when i do my rendering everythings work but the texture of the model is wrong. Also the size of texturesUV differe from vertexes and normals. I tryied the fallowing solution. Based on the vertexes indexes at initialization i check wich texture index is for the current vertex and push it in a vector "textures" - so now i have a vector the same size as "vertexes" - but... stii problem - the texture of the model is better (with this i meen - is not as messy as before but still wrong). i can render the object fine with VBO if i compute 3 vectors with all the vertexes all the normals and all the textures uv and bind it to a vbo. But this solution takes me 100fps for my model, since now i dont pass just 3000 individual vertexes but 12000 vertexes - many of them repeating. So i need to do my rendering with indexes. Is there a posibility to have 2 indexes for the vbo - one for vertexes and normals and one for the texturesUV? Thanks alot

Share this post


Link to post
Share on other sites
Advertisement
No, it is not possible. Your first solution should work though. Make sure that whatever attribute (vertex, normal, texcoord) the index points to is valid. This means possibly duplicating texcoords if there are fewer of them.

I don't know the mesh format you use, but you probably have to sit down with a simple model and understand exactly when and why it skips some texcoords.

Share this post


Link to post
Share on other sites
Actually you might want to try the reverse. Go through the vertex list and (in essence) duplicate vertexes so that you have as many vertexes as texture coordinates.

Share this post


Link to post
Share on other sites
thanks - but i always ( i mean with different models ) have much more vertex than textureUV

Share this post


Link to post
Share on other sites
The GPU is optimized to work with interleaved formats and to have a single index list. It good for the pre transform cache and the post transform cache.
So you have no choice.

12000 vertexes isn't a big deal.
100fps? I can't say much about it since it depends on how much screen space your triangles are taking, how much overdraw you have, the shaders you use.

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!