View Full Version : how to draw on the screen without cleaning others drawn object..?
06-27-2001, 10:21 PM
My drawing function CView::RenderScene is called on WM_PAINT event.
How can I draw something on the screen without clearing screen(put
OpenGL drawing code outside RenderScene function).
er. I don't know anything about the windows event model, but i'm guessin' its similar to X's event model (and how glut is like a duplo version of it=).
The short answer is:
you can stick gl commands anywhere in your program, and they WILL be rendered (providing you have a current opengl context, of course). you can draw stuff in the reshape callback, for example.
however: you may want to rethink how you're structurnig your program. do you really need to add drawing code elsewhere? consider this example:
void reshape(int w, int h)
this simple example will alternatively clear the screen every time the window is reshaped, but **the drawing code still remains in the render fucntion**. So, think abouyt your program flow before you get too carried away.
i think what you will do, is only clear the depthbuffer(if you use one), so you can draw over the last frame without clearing it
06-28-2001, 05:34 AM
Also override the OnEraseBkgnd() function and have it simply return TRUE, or windows will try to clear the scene for you.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.