I have a loop that runs through polygons and verticies to render a model (the basic routine). It works fine, except I need it to loop differently, to work with a collision library.
Code:
glBegin( GL_TRIANGLES );
{
for ( int j = 0; j < objectP->m_pMeshes[i].m_numTriangles; j++ )
{
int triangleIndex = objectP->m_pMeshes[i].m_pTriangleIndices[j];
const Triangle *pTri = &objectP->m_pTriangles[triangleIndex];
for ( int k = 0; k < 3; k++ )
{
int index = pTri->m_vertexIndices[k];
glNormal3fv( pTri->m_vertexNormals[k] );
glTexCoord2f( pTri->m_s[k], pTri->m_t[k] );
glVertex3fv( objectP->m_pVertices[index].m_location );
}
}
}
glEnd();
The bolded code is the main problem. For each triangle, it then loops through 3 verticies. I want it to do 3 verticies at once....
Code:
for(blah blah...<numtris..blah)
{
glVertex3f(...);
glVertex3f(...);
glVertex3f(...);
}
...but i'm not sure how to go about it. Iv'e tried different things, but I just end up with severe poly scattering. I'm not sure if i'm making sense, but if I am, please help!
thanx
-psychopath