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)?
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)?