If I have glClear() in the main loop, this causes my PC to hang for one second after hitting the ESC to quit the application.
Any reasons why glClear() causes this behaviour? Obviously, putting SwapBuffers() after glClear() eliminates the problem.
I assume you’re drawing in the idle loop?
(I consider this bad Windows programming style in general, there are only very few excuses.)
I suppose all the clears are buffered and need to finish before the program can exit.
SwapBuffers seems to limit the amount of buffered commands, otherwise interactive content would lag too much.
What I mean is i’m experimenting to see what would happen to the output. Here is my code:
while ( !(GetAsyncKeyState(VK_ESCAPE) & 0x8000) )
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//glClearColor(0, 0, 0, 0);
The Demo() has the actual drawing routines…
Sorry, I have no idea what your trying to achieve.
Your code doesn’t contradict my previous post.
You send a glClear in the main event loop.
Fine, the OpenGL driver may be able to buffer many of those. If you don’t flush, finish or swap the OpenGL driver may still have a thousand clear commands to chew on until your program can exit.