SDL Problem: From 8766 fps to 14 fps with one single SDL_flip

Started by
5 comments, last by Zredna 22 years, 4 months ago
My SDL program is running very slow (13-14fps). I think the problem lies in the monitor refreshrate. Bacause when I comment all the graphics funktions (put a // before so they aren't executed) the framerate suddenly goes up to 8766, and if I then uncomment only the SDL_flip function the framerate goes back to 14 fps... But if that is my problem, how do I then disable screen sync? And if you think the problem could be something else I would also be glad to hear. Thanks -Zredna Edited by - Zredna on December 12, 2001 4:15:05 PM
Advertisement
What are your system specs? (a.k.a RAM, Central Proccessing Unit speed, video card)
------------------------------Put THAT in your smoke and pipe it
I did not really think they would matter, but I may be wrong. Anyway here they are:

OS: Linux (Mandrake 8.1)
CPU: P3 450Mhz
RAM: 128MB
Graphic card: Voodo 3 3000
I have a Vodoo 3 also, and I tend to recieve low frame rates, but I also have about half of everything else you have (200 mhz, 64 mb of Ram, and I use Windows).

I am not really good with hardware problems, so I looked through the SDL main page ( libsdl.org ) and unfortunately didn't find anything. I am sorry I couldn't help. If you have some time, you could try searching the SDL webpage.

Edited by - Drizzt DoUrden on December 12, 2001 4:18:38 PM
------------------------------Put THAT in your smoke and pipe it
are you sure your framerate counter is correct? (moniters dont sync at 14 the lowest they sync is 60). what is your framerate if you comment all physics, ai, input, sound except the flip()?
Drizzt DoUrden>>
But I have never had the problem before. Even Quake III runs 7x faster than my program. Also I do not have the problems with any other SDL programs.

I has allready checked the SDL homepage, could not find anything through :-(

a person>>
I am pretty sure my framecounter works... But have a look yourself:
// This is called when the program quits
printf("Average FPS: %i", framecount/(SDL_GetTicks()/1000) );

When I remove everything but the SDL_Flip I get a framerate @ 33-34
you really should use floating point values for framerate calculations otherwise you may get bad results due to rounding (though i dont think this is the problem).

printf("Average FPS: %02.02f", (float)framecount/((float)SDL_GetTicks()/1000.0f) );

how long are you letting the program run? it is very possible that your initilization is throwing off your framerate off, since SDL_Getticks() is from the init of the library. you may consider storing a starttime value where you call
starttime = sdl_geticks() after all init is done and you begin yoru main loop. then calc the framerate like:

printf("Average FPS: %02.02f", (float)framecount/((float)(SDL_GetTicks()-starttime)/1000.0f) );

that may fix your problem. (i have had problems like that before as well so its a good idea to try it out, you might be surprised)

This topic is closed to new replies.

Advertisement