![]() |
| | #1 |
| The Right Honourable Join Date: Mar 2004 Location: Where circles begin.
Posts: 1,068
| 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();
Code: for(blah blah...<numtris..blah)
{
glVertex3f(...);
glVertex3f(...);
glVertex3f(...);
}
![]() thanx -psychopath
__________________ Memorial University of Newfoundland Computer Science Mac and OpenGL evangelist. |
| psychopath is offline | |
| | #2 |
| Has a Masters in B.S. Join Date: Aug 2001
Posts: 2,267
| this should work unless i am missing something? 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];
int index = pTri->m_vertexIndices[0];
glNormal3fv( pTri->m_vertexNormals[0] );
glTexCoord2f( pTri->m_s[0], pTri->m_t[0] );
glVertex3fv( objectP->m_pVertices[index].m_location );
int index = pTri->m_vertexIndices[1];
glNormal3fv( pTri->m_vertexNormals[1] );
glTexCoord2f( pTri->m_s[1], pTri->m_t[1] );
glVertex3fv( objectP->m_pVertices[index].m_location );
int index = pTri->m_vertexIndices[2];
glNormal3fv( pTri->m_vertexNormals[2] );
glTexCoord2f( pTri->m_s[2], pTri->m_t[2] );
glVertex3fv( objectP->m_pVertices[index].m_location );
}
}
glEnd();
__________________ ADVISORY: This users posts are rated CP-MA, for Mature Audiences only. |
| no-one is offline | |
| | #3 |
| The Right Honourable Join Date: Mar 2004 Location: Where circles begin.
Posts: 1,068
| Naturally, the one thing I didn't try would be the solution :P. Thanx, It works perfectly. Now all I have to do is work out the bugs in the collision system. *cringes* -psychopath
__________________ Memorial University of Newfoundland Computer Science Mac and OpenGL evangelist. |
| psychopath is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| My loop within loop won't work | Ayreon | C Programming | 3 | 03-18-2009 10:44 AM |
| Personal Program that is making me go wtf? | Submeg | C Programming | 20 | 06-27-2006 12:13 AM |
| scene graph rendering techniques | ichijoji | Game Programming | 7 | 03-19-2006 12:17 AM |
| while loop help | bliznags | C Programming | 5 | 03-20-2005 12:30 AM |
| loop issues | kristy | C Programming | 3 | 03-05-2005 09:14 AM |