Possible Duplicate:
VBO – Indexation without indexation
Here is my problem, I wanna render a huge model (one million of face), I’ve got an index buffer for the faces.
I’ve generate myself a texture for this model, and each region of the texture has to be applied to each triangle. I cannot unfold properly the model, because it will take too much of time, so a Vertice can have multiple texture coords.
Without VBO my renderer is like this :
glBegin(GL_TRIANGLES);
for (unsigned int i = 0; i < g_pModel->GetNbTriangle(); i++)
{
glTexCoord2f(TextCoord[6*i+0],TextCoord[6*i+1]);
glNormal3f(Normal[3*Triangle[i].x],Normal[3*Triangle[i].x+1],Normal[3*Triangle[i].x+2]);
glVertex3f(Vertex[Triangle[i].x].x,Vertex[Triangle[i].x].y,Vertex[Triangle[i].x].z);
glTexCoord2f(TextCoord[6*i+2],TextCoord[6*i+3]);
glNormal3f(Normal[3*Triangle[i].y],Normal[3*Triangle[i].y+1],Normal[3*Triangle[i].y+2]);
glVertex3f(Vertex[Triangle[i].y].x,Vertex[Triangle[i].y].y,Vertex[Triangle[i].y].z);
glTexCoord2f(TextCoord[6*i+4],TextCoord[6*i+5]);
glNormal3f(Normal[3*Triangle[i].z],Normal[3*Triangle[i].z+1],Normal[3*Triangle[i].z+2]);
glVertex3f(Vertex[Triangle[i].z].x,Vertex[Triangle[i].z].y,Vertex[Triangle[i].z].z);
}
glEnd();
With my VBO I can’t use glTexCoordPointer because it requires as much texture coords as vertexes, and it’s not my case.
Is there a way to do that with VBO and my shader (i’m using GLSL)?
I already told you, that you have to decompose your shared position multiple texture coordinate triangle corners into multiple vertices. A vertex always has exactly one texture coordinate on a given texture. If there’s a difference in texture coordinates, but on the same position, you’ve got different vertices.