performance tips

I ran into some performance troubels. To picture what i’m doing: loading in 2 md2 models, put them on the screen (one next to the other), i have texturing and 2 lights (one red one green) shining on them.
I use vertex/normal/textcoord arrays and drawelements() to render.
my render loop looks like:

gluLookAt(X,Y,Z, viewX,viewY,viewZ, viewUpX,viewUpY,viewUpZ);

then loop the models, in this case 2 times:


i tried taking out the matrixmode call, and the loadidentity and glulookat by doing it all in the beginnen and then pushing the matrix, but it has little or no effect.
on the radeon9800 it runs @ 1500+ fps, but on a geforce2 it only has 25fps!!
when i drag the window below the screen, so only the window title bar is visible, the fps rises upto 205fps… does that mean it’s just the rendering going slow and my main loop coding is good?

any thoughts? (i’m using c++)

that’s very odd. without seeing the rest of the code, i can only speculate. could be you have some freaky state that’s forcing a software path. are you getting any errors from glGetError()? i have played with md2 models on a gf2 with no trouble. could be driver version, could be lots of things. 25 fps seems very, very slow, even for a gf2.

Exactly… The 205fps i get when moving the window out of sight is more what i would expect.
I have installed Quake3 to test it, and even in windowed mode Quake3 runs very smooth on the gf2, so there should really be something wrong with the program…

the missing code is (translate+drawmodel):

glVertexPointer (3, GL_FLOAT, 0, frame->verts);
glNormalPointer (GL_FLOAT, 0, frame->norms);
glTexCoordPointer (2, GL_FLOAT, 0, frame->texts);

that looks fine to me. have you tried unsigned int indices instead of the shorts? just a guess… do the models look ok? any artifacts?

models look ok… ( ) only the textures are sometimes a bit stretched, but i think it’s just because i need to use text coords between 0 and 1 so i divide all the coords by the height/width of the texture…

i really have no idea
help :slight_smile:

i just tried disabling texturing… the fps just stays the same, sometimes goes one up (26, yay!).

sometimes goes one up (26, yay!).
heck, call it a day :smiley: .

hmmm, as a test, i would build a list of 1000 simple triangles, and render them using exactly the same technique. but don’t use tex coords or normals, just the indexed verts. disable blending, texturing, alpha test, depth test, stencil test, cull face, lighting, … everything. once you get the triangle code up to speed, add the states back one at a time, and test.