PDA

View Full Version : Transparent/Translucent OpenGL Windows



Michael Chapman
05-26-2004, 02:49 PM
Hi,

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 ?

IronicResearch
06-05-2004, 09:38 AM
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.

Michael Chapman
06-07-2004, 05:47 PM
Great, thanks for the feedback, I'll give it a try!