The following two methods produce the same results. I am working through some Game Institute courses and I am trying to figure out a few specific details about these different methods.
First Method 1 once rendered has the mesh rotating at a very slow rate where mesh 2 rotates the mesh much faster. I don’t really understand why anything within this code would effect a rotating speed. Can anyone offer advice why?
Second, I don’t understand why in method 2 there is a need to pass g_TriangleCount3 in the
glDrawElements(GL_TRIANGLES,g_TriangleCount3,GL_UNSIGNED_SHORT,
function call. The second param in the glDrawElements function needs to be the number of triangles so why is there a need to multiply the triangles by 3. Multiplying by 3 returns the number of vertex’s right?
Render Mesh 1
glBegin(GL_TRIANGLES);
for(TriangleNum=0; TriangleNum{
for (int VertexNum = 0; VertexNum < g_VertexCount; VertexNum++)
{
glVertex3f(g_pVertices[VertexNum].x,g_pVertices
[VertexNum].y,g_pVertices[VertexNum].z);
}
}
glEnd();
Render Mesh 2
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, g_pVertices);
glDrawElements(GL_TRIANGLES,g_TriangleCount*3,GL_UNSIGNED_SHORT, g_pFaceIndices);
glDisableClientState(GL_VERTEX_ARRAY);