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.
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.
Or render both to bitmaps and blit them to one window.
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.