PDA

View Full Version : Slowing Frame Rates and Display Lists


Nick
2005.03.27, 01:53 AM
I'm using display lists to try and raise my framerate (currently hovering between 20-24 fps with only four objects on screen). I'm wondering if it's my display lists. They should increase fps a little, right?

My code looks like this:

...
(Mesh::Update())
glNewList(list,GL_COMPILE);
for(int i=0; i<numFaces; i++)
{
f[i].Draw();
}
glEndList();
....
(Face::Draw())
texture.Bind();
glEnable(GL_TEXTURE_2D);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if(textureLevel==NO_TEXTURE)
{
glDisable(GL_TEXTURE_2D);
glColor4f(.7,.7,.7,1);
}
if(numVertices==3) { glBegin(GL_TRIANGLES); }
if(numVertices==4) { glBegin(GL_QUADS); }
for(int i=0; i<numVertices; i++)
{
vn[i].MakeGLN(); //make a normal
tc[i].MakeGLT(); //make the texture coordinates
v[i].MakeGLV(); //make the vertex
}
glEnd();
...


It's only making one display list (i.e. it's not remaking it each time because of my if statements) so I'm not sure if this has anything to do with my framerate. Does this look alright or should I have fewer nested functions (and manually do the normal, t.c., and vertex without those functions)?

Dan Potter
2005.03.27, 02:41 AM
This may or may not be related to what you're doing, but a member of our local IGDA group was telling me that Apple has some issues with display lists and speed. Something about how using certain types of objects with them will cause it to manually resubmit the primitives instead of DMAing them directly.

Wish I could remember exactly what he said now...

FCCovett
2005.03.27, 04:31 AM
http://developer.apple.com/graphicsimaging/opengl/index.html

On that page, there are a few "must read" tips on how to use display lists and how to order the elements you are drawing with OpenGL.

arekkusu
2005.03.27, 05:04 AM
If your bottleneck is submission, display lists will help. If your bottleneck is fill rate, display lists won't help at all.

You need to profile your app to figure out what part to spend time optimizing.

wadesworld
2005.03.27, 09:08 AM
But in the most broad terms, certainly display lists will show a dramatic speed improvement over immediate mode.