PDA

View Full Version : Undesired clearing of the front buffer



halo
03-30-2004, 08:32 PM
How can I avoid the "clearing" of the front buffer caused when another window is dragged over the glviewport, or when the viewport is dragged outside the bounds of the desktop, then back in again?

This is for an event-based application, so I only render when something changes or if the viewport needs to be refreshed. I don't want to render continuously while the user is dragging the window or whatever, I just want Windows to NOT screw up my viewport, or else just redraw whatever was there.

I have seen OpenGL applications that do this without re-rendering the window, so it must be possible.

Honk
03-31-2004, 12:00 AM
That depends on the window class you are registering. Try adding the CS_SAVEBITS to the class style and see if that helps.

halo
03-31-2004, 06:36 AM
I have no idea what that means. My DLL receives a hWND of a window or gadget from an external program, and creates an OpenGL viewport for it.

Deiussum
03-31-2004, 10:19 AM
Your app should look for the WM_PAINT message, and redraw the scene when it is received. If you don't do that, you'll run into problems not only with the instances you mentioned, but also many other cases, such as resize, minimize/restore, etc.

Honk
03-31-2004, 12:05 PM
Well I did not know that you only have an HWND handle to work with.

In this case Deiussum is right, you will run into lots of trouble if thats everything you have.

What I suggested was to register a new windows class that has the CS_SAVEBITS style. Using this style Windows will take a "screenshot" of the area that will be overdrawn by i.e. a dialog and silently restore the pixels when the dialog is closed/moved _without_ sending a WM_PAINT message.

A very handy style IMHO.

But since you have to work with a HWND it looks like that this is not an option for you.

I am sorry but based on the info you have given I cant offer you any advice.

halo
04-02-2004, 05:34 PM
And you can't modify the hWND, like with SetWindowLong() or something?

Honk
04-04-2004, 10:21 PM
Well you can, however the application that created and controlls the HWND may not take it so kindly if you change the behavior of the window.
Since I dont know the circumstances I cant recommend anything in that regard.

The appropriate function would be:

SetClassLong() or SetClassLongPtr() the documentation can be found at msdn.microsoft.com