so how? my app is running at 60FPS, but i want 30.
Assuming you have a target frame rate, you could measure how long its been since the last time you finished rendering. From there, you could sleep for targetMsPerFrame – timeElapsed.
Take a look at WGL_EXT_swap_control or GLX_EXT_swap_control extensions, regarding to your operating system. This is used to control the VSync, but should be usefull to render at half your monitor refresh rate.
@itzWarty has a correct answer on how to set your framerate. It’s called “clamping” or “locking” the framerate.
But why do you want to do that? If you’re trying to avoid hogging resources, clamping the framerate is good.
Otherwise you might want to let framerate go as fast as possible, in order to make people with great honking graphics cards feel like they didn’t waste their money. In that case you need to make your animation time-based rather than frame-based. I.e. scale your animation steps according to how much time has passed since the previous step. E.g.
x += dx * (timeNow - timePrev) / typicalDuration; // pseudoCode