Wasn't quite sure where to post..

Window Transparency/Opacity in SDL/OpenGL on Win32

Posted 06 November 2009 - 11:04 PM

Does anyone here know how to get window transparency/opacity using the Simple Direct Media Library (SDL)/OpenGL (OGL) on Win32? I'm not talking about transparency with graphics objects inside the window, I'm talking about transparency of the window with other desktop objects like the wallpaper, other application windows, etc. Is it even possible? If not, can someone recommend me another useful media library compatible with C/C++ and Win32 that I can use for this task? Also, does anyone know how to get/set window position in Win32 using SDL, or, again, is this even possible? Last but not least, how can I retrieve and manipulate screenshots (using the print screen button) in Win32 with SDL?

Here are two examples of what I'm trying to do regarding transparency/opacity (Photoshop'd for demonstration; ignore the dock; click for full view):

I'd like to write my own Win32 GUI applications like dock, launcher, etc, but the first two issues mentioned aboved (window transparency/opacity and position) are currently preventing me from doing so.

Thanks in advance, and sorry if this is the wrong forum, I looked around but I couldn't find anywhere else that looked suitable to post.

This post has been edited by GunnerInc: 21 December 2012 - 05:54 PM
Reason for edit:: URLs removed

Re: Window Transparency/Opacity in SDL/OpenGL on Win32

Thanks, that helped a lot. I've managed to get this (not Photoshop'd, whoo):

I used the WinAPI functions SetLayeredWindowAttributes() and SetWindowRgn() for the partially translucent window application and the red circle application, respectively. Unfortunately, with SetLayeredWindowAttributes() I can only set the entire window (or a specific color) to a certain level of opacity, not individual pixels, and with SetWindowRgn I can set individual pixels as either fully visible or fully transparent, but not anywhere in-between (e.g., 50% opacity). I need to be able to selectively set any individual designated pixels to any percentage of opacity (0-255).

So essentially, my question comes down to this, how can I achieve this with the WinAPI? (or by whatever means, so long as it's on Win32):

If my dock can do it then it must be possible (somehow).

This post has been edited by GunnerInc: 21 December 2012 - 05:53 PM
Reason for edit:: URLs removed