I have a modern CPU (AMD FX 4170) and a modern GPU (NVidia GTX 660). Yet this simple program manages to fully use one of my CPU's cores. This means it uses one 4.2 GHz core to draw nothing at 60 FPS. What is wrong with this program?
#include <SDL/SDL.h>
int main(int argc, char** argv)
{
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
SDL_SetVideoMode(800, 600, 0, SDL_OPENGL | SDL_RESIZABLE);
while(true)
{
Uint32 now = SDL_GetTicks();
SDL_GL_SwapBuffers();
int delay = 1000 / 60 - (SDL_GetTicks() - now);
if(delay > 0) SDL_Delay(delay);
}
return 0;
}