Hi,
I’ve been coding some simple OpenGL programs, and using SDL_GetTicks,
have measured its performance. As they are running at over 200fps
average, which is not very useful, I would like to know if there’s some
simple technique to delay the code to put a limit to this, for example
at 50fps.
I’m coding a very simple loop like this:
while ( ! done ) {
DrawGLScene();
{ SDL_Event event;
while ( SDL_PollEvent(&event) ) {
if ( event.type == SDL_QUIT ) {
done = 1;
}
if ( event.type == SDL_KEYDOWN ) {
if ( event.key.keysym.sym == SDLK_ESCAPE ) {
done = 1;
}
}
}
}
}
Also, I would like to know if SDL_GetTicks is suitable for finding out
how much time has passed between two consecutive frames; i.e. at current
speeds, there are 4 ticks between most frames, which is rather curious.
Best regards,
Alex