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 4 of 4

Thread: Non-rectangular GL Window

  1. #1
    Intern Newbie
    Join Date
    Jan 2006
    Location
    Dayton, OH
    Posts
    34

    Non-rectangular GL Window

    I have an MFC Open GL project where I display GL in the client window, but I would like to sometimes display a child window in the corner of the window to show additional information. This in itself works fine.

    The problem I am having is that the child window flickers badly each time the GL window is update (eg, when being rotated). The GL window works fine. My first attempt to solving this was to declare the parent and GL windows with the WS_CLIPCHILDREN and WS_CLIPSIBLINGS since that is suppose to prevent Windows from drawing in the child window during redraw - but that doesn't work. My assumption of why this isn't working is that GL is writing to the window directly and bypassing Windows. But maybe thats a bad assumption.

    My next idea was to define a clipping region in GL to exclude the child window - in effect defining an L-shaped output window for GL. That didn't work either, mostly because there doesn't seem to be a way to do that. glViewPort only allows you to define a rectangular window, and I can't find any commands that allow you to exclude a portion of the output window.

    Does anyone have any ideas? Thank you for your help.

  2. #2
    Intern Contributor
    Join Date
    Feb 2002
    Posts
    58

    Re: Non-rectangular GL Window

    A few comments. First of all, is the info window a child of the OpenGL window, or a sibling? WS_CLIPSBLINGS is useless if it's a child, and WS_CLIPCHILDREN is useless if they're siblings.

    Whatever your response is to the first question, you might try doing whatever it is you're not currently doing. So if the info window is a sibling of the OpenGL window, then change it to be a child, or vice versa. My tendency would be to believe that having it be a child of the OpenGL window would make more sense. If it's a sibling, you do have to make sure to create the windows in the correct order, or the clipping won't work right.

    Finally, there's a solution that's guaranteed to work, but it's going to be slow. You can create two OpenGL windows, and lay them out so they avoid the info window, then set up your matrices such that your scene draws in a way that creates a seemless tiling of the image. You can find instructions for tiled OpenGL rendering on the net via Google. You'll have to modify them to account for the fact that your two tiles aren't the same shape as each other.

    And it will be slow for two reasons: first, because you have to draw everything twice, and second because you have to switch between rendering contexts. However, depending on what you're drawing, it might still be acceptable.

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2006
    Posts
    26

    Re: Non-rectangular GL Window

    Or render both to bitmaps and blit them to one window.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    Kristianstad,Skåne,Sweden
    Posts
    1,651

    Re: Non-rectangular GL Window

    WM_ERASEBKGND ?

Posting Permissions

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