I know what is the bottleneck but how to solve it ?


I have a freeware game which will have a final release in 2 weeks. http://www.multimania.com/nitrocodecorps
‘F’ to have the FPS

When I draw 2D background and Icons to play : 90 fps ( TNT2 m64 )
Since I start to draw only the ground, 60fps( no depth buffer test ), +Hero 40fps, +walls 20fps
And it’s not resolution dependant, FPS are the same for 640480 and 12801024.
And shame on me: 2200 poly per frame

Here is how I draw my objects (OpenIL Loads textures ):
Note: I have the same result with this and with movements inperpolated and polygons sent with glBegin( GL_TRIANGLES )… glEnd();

glEnableClientState(GL_TEXTURE_COORD_ARRAY );
glEnableClientState( GL_NORMAL_ARRAY );
glEnableClientState( GL_VERTEX_ARRAY );
glColor4f( 1.0f, 1.0f, 1.0f, 0.0f);

for(int a=0 ; a<this->nb_sub_objects ; a++ ){

glVertexPointer( 3 , GL_FLOAT , 0 , this->tab_de_ver[a] );
glNormalPointer( GL_FLOAT , 0 , this->tab_de_nor[a] );
glTexCoordPointer( 2 , GL_FLOAT , 0 , this->tab_de_tex[a] );

glDrawArrays( GL_TRIANGLES , 0 , this->nb_vertex[a]*3 );


glDisableClientState( GL_VERTEX_ARRAY );
glDisableClientState( GL_NORMAL_ARRAY );
glDisableClientState( TEXTURE_COORD_ARRAY );

Can you help me ?? Please, it’s a freeware … Please gurus …


Since geometry doesn’t seem to be your problem, the only other thing might be that you switch textures too often. Do you sort the geometry you draw by the textures they use? How big is that background image? If it’s too large, maybe it is causing textures to be swapped into main memory. Try drawing everything BUT the background and see what frame rate you get.

Let me know how it goes ,


I think i found you’r problem
How many sub-objects do you have ? Because you should bind textures as less as possible (i don’t know if it’s a good english sentence). I don’t know how you draw u’r objects but you should change you’r method (at least for the textures).

Hope that helped

To start off, framerate is the same with or without background and with all the geometry out of frame. But I have 32mo of RAM and with backgrounds of 256256 or 512512, it’s the framerate one more time, doesn’t change.

You are surely right about textures…
In fact, I didn’t say that sometimes glTexture2D return a good value and that in the game, object are completely white, like if I wrote glBindTexture( … , 0 );
It appears regularly and is always at the start of the game, sometimes, after 10 secondes, textures are coming !? and it seems completely unpredictable.

So I just tried to remove every glBindTexture2D of the program, and… textures loaded by OpenIL ( I didn’t remove the calls ) are loaded in a completely random order, without explicit calls !

I seems to be a enormous memory bug. Maybe I don’t use OpenIL like it should be used. So I’m going to investigate.

Thanks a lot to put me on the way.

You said it does 60 FPS at any resolution with just the background? It might be that you have vsync enabled on your drivers. I’d check that first before mangling your codebase. Just a thought.

At the beginning at didn’t think it was possible so yes, I gone in the drivers options and:
Vertical synch -> Always OFF
All bench are with VSynch off.

Does somebody ever been confronted with a tiny memory bug which killed performance?