PDA

View Full Version : Display list performance



Dario
11-24-2003, 01:59 AM
Hello,

I am porting my Mac OS X OpenGL application to Windows XP, and I'm using Visual C++ 6.0 to compile it. My x86 laptop has a P4/3.06GHz with 768MB RAM, runs XP Pro, and sports an nVidia GeForce FX Go5200 card with 64MB VRAM.

Previously I used glDrawElements to display my meshes. I am now moving to display lists all meshes whose geometry does not change. In order to avoid too much overhead with display lists, only meshes that have at least n (currently 8) vertices are converted to display lists; the others still use glDrawElements.

Using display lists results in a 3x performance boost on Mac OS X: from a 24 FPS average to a 72 FPS average, with CPU usage from 80% to 20% on average. However, on my Windows box I actually notice a *decrease* in FPS (about 9 less with display lists versus glDrawElements), and only a very slight performance increase in CPU usage (from 81% to 77%).

This is the code I'm using to create my display lists:



glBegin(GL_TRIANGLES);
for (int iTriangle = 0; iTriangle < iTriangles; ++iTriangle)
{
int iIndex = iTriangle * 3;
for (int i = 0; i < 3; ++i)
{
int iVertex = aiConnect[iIndex + i];
if ( afTextures0 )
glMultiTexCoord2f(GL_TEXTURE0_ARB,
afTextures0[iVertex].X(),afTextures0[iVertex].Y());
if ( afTextures1 )
glMultiTexCoord2f(GL_TEXTURE1_ARB,
afTextures1[iVertex].X(),afTextures1[iVertex].Y());
if ( afTextures2)
glMultiTexCoord2f(GL_TEXTURE2_ARB,
afTextures2[iVertex].X(),afTextures2[iVertex].Y());
if ( afTextures3)
glMultiTexCoord2f(GL_TEXTURE3_ARB,
afTextures3[iVertex].X(),afTextures3[iVertex].Y());
if ( afColors )
glColor3f(afColors[iVertex].r,afColors[iVertex].g,
afColors[iVertex].b);
if ( afNormals )
glNormal3f(afNormals[iVertex].X(),afNormals[iVertex].Y(),
afNormals[iVertex].Z());
glVertex3f(afVertices[iVertex].X(),afVertices[iVertex].Y(),
afVertices[iVertex].Z());
}
}
glEnd();


On Mac OS X this code does indeed give the expected results: much better FPS and seriously reduced CPU usage. Not so on XP Pro.

Am I missing something obvious on Windows?

Thanks,
Dario