Sign in to follow this  
guvidu

index VBO with 2 index array ? is that posible?

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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this