I just made my first game, a clone of Pong, using OpenGL and C++. But its using ~50% of the CPU, which I guess is very high for a game like this. How can I improve that? Can you please look up my code and tell me what all things I am doing wrong? Any feedback is welcome.
http://pastebin.com/L5zE3axh
Also it would be extremely helpful if you give some general points on how to develop games in OpenGL efficiently..
Thanks in advance!
EDIT 1:
I forced VSync on from CCC, and now the game just shows ~5% CPU usage, except when my own wait() method is called (my fault). I can solve that...but now another problem has come, the game feels very choppy and its not smooth after forcing on VSync. Maybe tearing because of single buffering?
Any ideas?
EDIT 2:
Was calling the display callback twice from my idle function, using display() and glutPostRedisplay()! Also, changed the mode to GLUT_DOUBLE, now Fraps works on it..
One more thing! This game is working fine with VSync on (or forced) at 60fps.. but when I turn off VSync, it goes too fast. Do I have an option to turn on VSync? Or is any any other way?