Sign in to follow this  
Rasmadrak

VBO indices problem...

Recommended Posts

Hi again, I'm having quite some struggle with VBO's, more precisly indexed VBOs. Could someone explain why this works...
                        for (int i=0; i < T->meshes[a]->indexCount; i++)
                        {
                            glTexCoord2fv(&T->meshes[a]->uvs[i].x);
                            glVertex3fv(&T->meshes[a]->vertices[T->meshes[a]->indices[i]].x);
                        }

...while VBO's provides funky UV's? Vertices seem correct as the structure of the models are correct. I also tried to modify the loading, and that helps to some extent - but some areas of the model are still problematic:
                mesh->uvs = new var2<float>[mesh->uvCount];
                var2<float> *uvs = new var2<float>[mesh->uvCount];
                data.read((char *)(&uvs[0]), sizeof(var2<float>)*mesh->uvCount);

                for (int i=0; i < mesh->indexCount; i++)
                mesh->uvs[mesh->indices[i]] = uvs[i];

Since the immediate mode rendering can be controlled to a higher extent, I suspect that my exporter is providing false uv-coords and that I "repair" these in code. But as VBO expect a more rigid structure, rendering gets messy. I'm getting both cross-eyed and grey-haired from this dilemma, and would be grateful for any tips. :) Thank you for your time! /Robert

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