Archived

This topic is now archived and is closed to further replies.

Zredna

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

Recommended Posts

Zredna    122
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

Share this post


Link to post
Share on other sites
Zredna    122
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

Share this post


Link to post
Share on other sites
Drizzt DoUrden    100
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

Share this post


Link to post
Share on other sites
a person    118
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()?

Share this post


Link to post
Share on other sites
Zredna    122
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

Share this post


Link to post
Share on other sites
a person    118
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)

Share this post


Link to post
Share on other sites