Original Post
The following code renders at 170fps:
glBegin(GL_TRIANGLE_STRIP);
glNormal3f(normals[0], normals[1], normals[2]);
glTexCoord2f(t[0], t[1]);
glColor3f(colors[0], colors[1], colors[2]);
p1.vertex();
glDisable(GL_COLOR_MATERIAL);
glNormal3f(normals[3], normals[4], normals[5]);
glTexCoord2f(t[2], t[3]);
glColor3f(colors[3], colors[4], colors[5]);
p2.vertex();
glDisable(GL_COLOR_MATERIAL);
glNormal3f(normals[6], normals[7], normals[8]);
glTexCoord2f(t[4], t[5]);
glColor3f(colors[6], colors[7], colors[8]);
p4.vertex();
glDisable(GL_COLOR_MATERIAL);
glNormal3f(normals[9], normals[10], normals[11]);
glTexCoord2f(t[6], t[7]);
glColor3f(colors[9], colors[10], colors[11]);
p3.vertex();
glDisable(GL_COLOR_MATERIAL);
glEnd();
If I place the code in the vertex arrays as follows, I only get 150fps! What gives ? Why are my vertex arrays slower ?
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vertices);
glColorPointer(3, GL_FLOAT, 0, colors);
glTexCoordPointer(2, GL_FLOAT, 0, t);
glNormalPointer(GL_FLOAT, 0, normals);
glDrawElements(GL_TRIANGLE_STRIP, 12, GL_UNSIGNED_BYTE, indices);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
Anyone ?
Another wierd thing (maybe its related)... The vertex arrays draw fine in Release mode, but the vertices are completely f****d in Debug mode. Its like one vertex from each square wants to go to a random location, mostly across the axis.
Thanks!
Nitzan
-------------------------
www.geocities.com/nitzanw
www.scorchedearth3d.net
-------------------------