View Full Version : Undesired clearing of the front buffer
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.
That depends on the window class you are registering. Try adding the CS_SAVEBITS to the class style and see if that helps.
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.
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.
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.
And you can't modify the hWND, like with SetWindowLong() or something?
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
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.