i am new to opengl but know c/c++ for years.
i just wrote my first opengl app and it works pretty fine.
but one thing is strange.
9 times out of 10 when i start the programm i have 15 FPS ( 1200x800:16@60 ) but 1 out of 10 i have a framerate of 30 - 40.
than the game is very fast and everything is renderd propably as well…
and i have no idea why … i have no frame limit implemented.
It could be a vsync issue, where you’re on the borderline of being able to complete each frame in time to be displayed.
eg. At 60 Hz, you have 16.66 ms to complete rendering in order for it be be swapped at the correct time. If you take less than this time, then you will maintain 60 FPS. If you take 17ms to render, you will need to wait for the next vsync event to occur at 33.33 ms, so your FPS will drop down to 30 FPS.
A slight difference in conditions when you start the program could be pushing you just over the limit, causing quite a large decrease in measured FPS. Try turning off vsync, or speeding your code up.
The frame rate with vsync on will be equal to the monitor refresh frequency divided by the number of interval periods that you need to render your scene completely.
less than 16.66 ms = 60 FPS
16.66 to 33.33 ms = 60/2 = 30 FPS
33.33 to 50 ms = 60/3 = 20 FPS
50 ms to 66.66 ms = 60/4 = 15 FPS
I’d recommend only switching vsync on if you’re capable of rendering faster than the refresh frequency.
sadly nothing worked out, but i checked some other strange behaviors.
i comented out all stuff in my display func, so i just get a black space…
if i run the game in a 800x600 window FPS is round 50
if i run the same in fullscreen 12800x800 its only round 15 FPS
as long as i do not draw anything… shouldent it be quite the same fps, as only calculations are done ?
to tell you the result:
i am a fool ! i should have check my available display modes.
setting it to one that is really available on my pc givs me a solid frame about 17-18. but according to what i am really rendering i guess thats slow …
anyway i just did something wrong here.
i am sorry to say, but it still happens …
using the right setting improves the fps but still from time to time, suddenly everything renders at twice the speen …
any ideas left ?