You have a problem with a game that I am making using opengl. The game will sometimes work at half speed, and sometimes it will work fine.
I donโt think this is the problem causing the problem, since it runs at literally 14,000 frames per second on my computer. (even when it is running at half speed)
This led me to think that this is a โgame timerโ that is causing the problem. The game timer starts on a separate thread and is programmed to pause at the end of the "loop" when calling "Sleep" (5). if I delete the Sleep (5) call, it works so fast that I can barely see the sprites on the screen. (predictable behavior)
I tried to reset Sleep (16) at the end of the Render () thread (also in my thread). This action should limit fps to about 62. Remember that the application runs at a certain speed, and sometimes at half speed (I tried on both computers that I have, and it persists).
When it runs at the set speed, fps is 62 (good), and sometimes the 31st (bad). it never switches between half speed and full speed full execution, and the problem persists even after a reboot.
So this is not a slow-rendering rendering, its Sleep () function
I assume that I am saying that the Sleep () function is incompatible with the time it really sleeps. is this a verified thing? is there a better Sleep () function that I could use?
source share