Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 7 of 7

Thread: Undesired clearing of the front buffer

  1. #1
    Member Regular Contributor
    Join Date
    Sep 2002
    Posts
    384

    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.

  2. #2
    Intern Contributor
    Join Date
    Mar 2004
    Posts
    62

    Re: Undesired clearing of the front buffer

    That depends on the window class you are registering. Try adding the CS_SAVEBITS to the class style and see if that helps.

  3. #3
    Member Regular Contributor
    Join Date
    Sep 2002
    Posts
    384

    Re: Undesired clearing of the front buffer

    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.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,797

    Re: Undesired clearing of the front buffer

    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.
    Deiussum
    Software Engineer and OpenGL enthusiast

  5. #5
    Intern Contributor
    Join Date
    Mar 2004
    Posts
    62

    Re: Undesired clearing of the front buffer

    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.

  6. #6
    Member Regular Contributor
    Join Date
    Sep 2002
    Posts
    384

    Re: Undesired clearing of the front buffer

    And you can't modify the hWND, like with SetWindowLong() or something?

  7. #7
    Intern Contributor
    Join Date
    Mar 2004
    Posts
    62

    Re: Undesired clearing of the front buffer

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •