Original Post
Hi, I'm not getting very good performance when rendering my BSP. I'm guessing that this might be to do with using glVertex3fv to render the faces rather than glDrawElements. I am checking if the face is visible before I render it so unless my code for checking the visibility is wrong I don't think this is the problem. I did read that using glDrawElements wasn't possible for Type 1 faces when rendering BSPs, but perhaps they were wrong. Here's the code for rendering Type 1 and 3 faces. Any suggestions would be appreciated. Thanks Richard
switch (bsp.faces.type)
{
case 1:
meshIndex = bsp.faces.meshVertIndex;
meshCount = bsp.faces.numMeshVerts;
vertexIndex = bsp.faces.startVertIndex;
glBegin(GL_TRIANGLES);
for (j=0;j<meshCount;j++)
{
offset = bsp.meshIndices[meshIndex + j] + vertexIndex;
glTexCoord2fv(&bsp.verts[offset].textureCoord.x);
glVertex3fv(&bsp.verts[offset].position.x);
}
glEnd();
break;
case 3:
offset = bsp.faces.startVertIndex;
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, sizeof(BSPVertex), &bsp.verts[offset].position);
glTexCoordPointer(2, GL_FLOAT, sizeof(BSPVertex), &bsp.verts[offset].textureCoord);
glDrawElements(GL_TRIANGLES, bsp.faces.numMeshVerts, GL_UNSIGNED_INT, &bsp.meshIndices[bsp.faces.meshVertIndex]);
glDisableClientState(GL_VERTEX_ARRAY);
break;
}