I originally posted this in the scripting forum as I'm using pygame, but I wrote a quick test app in C++ and it turns out the problem is with something outside of pygame so I thought I'd drop a line here since I wasn't getting any help there.
I wrote a super simple program to test for FPS when you're doing nothing but flipping, here it is:
timer.h
class Timer
{
public:
Timer()
{
numFrames = 0;
startTime = SDL_GetTicks() - 1;
fps = 0;
}
void Frame()
{
if ( SDL_GetTicks() - startTime >= 1000)
{
startTime = SDL_GetTicks();
fps = numFrames;
numFrames = 0;
}
numFrames++;
}
double GetFPS()
{
return fps;
}
private:
Uint32 numFrames;
Uint32 startTime;
Uint32 fps;
};
timer.cpp
#include "SDL/SDL.h"
#include "timer.h"
#include <iostream>
int main()
{
SDL_Init(SDL_INIT_VIDEO);
SDL_Surface *screen = SDL_SetVideoMode(640,480,32,SDL_HWSURFACE | SDL_DOUBLEBUF);
if( screen == NULL )
exit(1);
Timer timer;
while(true)
{
timer.Frame();
SDL_Flip(screen);
std::cout << timer.GetFPS() << std::endl;
}
return 0;
}
As you can see all it does is constantly flip in a tight loop, while keeping track of the current FPS.
When I'm not flipping I get an FPS of between 15k-23k. When I flip It won't get up above 43 fps.
I have no idea why but I'd *really* appreciate any input into this please.
I'm running a 2600+ AMD athlon-xp with 768MB ram with an nvidia Geforce FX with Gentoo Linux as my OS. My current refresh rate is 75hz I get up over 10k fps when running glxgears so I know my vid card is setup correctly :) I've looked through my kernel and verified that I've got the correct drivers installed for my mobo and agpgart is currently loaded as a module.
Does anyone have any ideas? Even if it's just a direction for me to look into I'd really appreciate it.