Transparent/Translucent OpenGL Windows


Not sure if this is possible but…

How can I create a window which is rendering an OpenGL scene, and have that window transparent/translucent (so that regular windows behind it will show through)?

Any ideas? is this possible? Can I do this with DirectX ?

This is not something that would be ordinarily doable since the OpenGL renderings are deliberately isolated from other window manager components.

To achieve an effect like this, you would have to try the following:

(1) Create a new window but prevent the client area from being erased when it is initially displayed. I don’t know if Win32 allows omitting a default brush, but I do know you could intercept the WM_ERASE* messages to prevent erasures.

(2) Use GDI to copy the client area contents into a buffer that you will want to blend with GL renderings. The unerased client area should be whatever was already drawn on the desktop.

(3) Render your GL scene normally, then blend the final rendering with the copied background buffer with alpha value set to amount of transparency desired.

This should give the effect you are looking for, but then you’d need to handle cases for windows moving and changing focus.

Sounds like the effect you are looking at is something like Mac OS X window manager, though you would probably have to use same transparency trick in GL client regions.

Great, thanks for the feedback, I’ll give it a try!

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