-
PeekMessage Windows XP
2 Q's in one : What is the best ( also what is the easiest ) way to stop openGL hogging all the CPU time yet still keeping
millisecond control over what is happening.
e.g.
update screen and check messages every 40 milliseconds
various delay loops I have seen - which ones pass control back to windows (tutorial wasn't clear)
and is threading better (i will have to learn loads for that).
Any advice would be great. No code needed.
to AndyHunter - sorry about hijacking other thread and I see your point about the int main(void) - I thought it was just good practice.
-
Do a search on this board for game loop. You will get what you need. Also on top of the game forum there are sticky's with very useful links to game development websites.
-
-
>update screen and check messages every 40 milliseconds
Have you tried:
Code:
Sleep(40); //Sleep 40 msec
-
-
>way to stop openGL hogging all the CPU time<
>Sleep(40); //Sleep 40 msec<
Absolutely not. This is not the solution you are looking for here.
-
You are probably not going to like it but I have given up on trying to stop openGL hogging all the CPU time. Its complicated but because I also need to accept user input I have just inserted timeGetTime() statements and compared them with each other.
Looking around best solution is to make WM_TIMER send message to the window and use getMessage instead of PeekMessage. I will expect to be totally wrong on this though.
Its been a long week learning C++ syntax.
Next week back to university where they want us to use MFC. Joy! Microsoft gets to tell me what to do for the next 3 months.