openGL UpdateLayerdWindow XP issue

I have an application which works fine in Win7 but has issues in XP.

The main window of my application is drawn using UpdateLayeredWindow. This works fine.

The application has a modal dialog that uses openGL as one of its child windows. This also works fine when the modal dialog is not positioned over the main window.

The problem is that if the modal dialog is moved over my main window and the main window changes (which can happen in the background), the main window tries to repaint including the area that is covered by my modal dialog’s openGL child window!

  1. Im surprized that it tries to draw the portion of the main window that is covered at all, since it covered by the dialog.

  2. Secondly, after doing this, no WM_PAINT message is then sent to my dialog’s child window to fix what has been drawn by the layered window.

Is there something I should be doing so that the layered window doesnt try to redraw that portion that is covered by the dialog? Some sort of clipping?

Or failing that, is there a way to insure the modal dialog’s openGL Child window gets a paint message when this happens, so I can fix what has been corrupted?

It seems to me the issue here is that the layered window doesnt know that it has been obscured by the openGL child window of the modal dialog.

The layered window doesnt corrupt the GDI portions of the modal dialog sitting on top of it (maybe it clips those portions, or maybe it repaints those portions, not sure), it only corrupts the openGL portions on top of it.

Are there any suggestins as to how I can inform the layered winodw that it is obscured by openGL?

To test my theory that UpdateLayeredWindows doesnt play nicely with openGL on XP, I rebuilt my app to use PFD_SUPPORT_GDI. The image corruption disappeared, but of course the image quality has decreased, and it flickers alot, but the openGL image above the layeredWindow now ends up being redrawn since it now gets Paint messages whenever the underlying layered window changes.

Not a great solution, but I hope it helps illustrate the issue.

Layered windows don’t co-operate well with opengl on XP and older windowses.
Basically the microsoft code which handles layered windows seems to totally disregard opengl. The situation is the same with their own api - d3d.

In the newer windowses the layered stuff seems to work correctly with opengl and d3d.

I was afraid someone might say that.

Does anyone have a solution to help me get around this issue?

  • a way of clipping the layered window under my openGL window
  • a way of linking into the paint chain to get my window to repaint?
  • a way of tricking the os into thinking the openGL area exists as a gdi window?

Did you set the ws_clipsiblings and ws_clipchildren styles to the dialog window?

Thanks for the suggestions. Yes I am. The only part of the dialog window which gets corrupted in XP is the openGL portion. The GDI portions are not corrupted in fact. There is no corruption under Win7.

Well if you don’t mind the speed, you can always render offscreen and then copy the picture by hand to the window (glReadPixels + BitBlt)

BTW what do you need the layered window for? Is it for semi-transparency or something else?

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.