View Full Version : PC interrupt using glClear

05-16-2003, 03:14 AM

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.


05-16-2003, 03:30 AM
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.

05-16-2003, 03:39 AM
Hi Relic

What I mean is i'm experimenting to see what would happen to the output. Here is my code:

while ( !(GetAsyncKeyState(VK_ESCAPE) & 0x8000) )
//glClearColor(0, 0, 0, 0);

The Demo() has the actual drawing routines...

05-16-2003, 06:02 AM
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.