My application have OpenGL Engine in a WPF hosted Window.
I created half-transparent widget (as Window object) that should display content above OpenGL window. Sometimes when application processing data, widgets backgrounds becomes black (see attached image).
Does anybody know what it is. How can I resolve this problem.
Asked
Active
Viewed 1,543 times
3

Adam D
- 191
- 1
- 8
-
As far as I know transparency only works between WPF items so I'm surprised it sometimes works for you. – Ignacio Soler Garcia Feb 28 '12 at 17:12
-
OpenGL window is not transparent but wpf window is. It is works very well but this problems comes when asyncronous rendering occures i think (my opinion) – Adam D Feb 28 '12 at 17:21
-
As far as I know WPF windows are only transparent to other WPF windows. You cannot put a WPF transparent control over a Windows Forms control and expect them to work. – Ignacio Soler Garcia Feb 28 '12 at 17:27
-
See this: http://khason.net/blog/transparent-wpf-control-over-unmanaged-window-handle/ – Ignacio Soler Garcia Feb 28 '12 at 17:28
-
There's an [interesting post here](http://stackoverflow.com/a/4055059/176769), it might be just what you are looking for. – karlphillip Mar 19 '12 at 15:07
2 Answers
3
Since Vista Windows supports a new PIXELFORMATDESCRIPTOR flag: PFD_SUPPORT_COMPOSITION
. If this flag is set, the OpenGL context creates will integrate into the desktop composition system:
http://msdn.microsoft.com/en-us/library/cc231189(v=prot.10).aspx

datenwolf
- 159,371
- 13
- 185
- 298
0
It's not guaranteed to work at all. OpenGL windows are not composited with WPF transparency, either below or above. It may work sometimes, but it doesn't have to.

Nicol Bolas
- 449,505
- 63
- 781
- 982
-
Compositing can be enabled for compositing. This is done through a new PIXELFORMATDESCRIPTOR flag. – datenwolf Feb 28 '12 at 17:27
-
First, that only composites with things behind it, not on top of it. Second, I don't see the equivalent in [wglChoosePixelFormatARB](http://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt), which is where most people get their pixel formats from. Otherwise, you couldn't use sRGB framebuffers or multisampling. – Nicol Bolas Feb 28 '12 at 17:30
-
@datenwolf: And third, there's no guarantee that PFD_SUPPORT_COMPOSITION will not turn off hardware acceleration or force use of the Microsoft GL driver. There's no guarantee it will do that either, but I'd want more info before trying to make such a change. – Nicol Bolas Feb 28 '12 at 18:12