create window with WS_EX_LAYERED (or something like that)
Create FBO or PBuffer
render scene into pbuffer
geta data back to cpu mem from pbuffer or map using copypixel or use FBO target
create compatible dc and use it memory mapped with ABGR bits compatible with graphics data previously copied
use updateLayeredWindow with alpha blending or color keying
Would this be reasonable fast ?
I have made tests with rendering using non double buffer + ws_ex_transparent to enforce obscured window repaint +savebits in window class but this flickers too much
Don’t want to copy background as i want to be able to move other windows around on the desktop that might be obscured by the ogl window…
Is there a way to detect and copy the desktop dc + all rendered windows into a bitmap ? Can i get a hook on the desktop window and get the WM_PAINT to be able to keep a correct painted background of the dc ?
Hello there
Instead of you manually copying the desktop into buffer why don’t you try out the winapi functions SetLayeredWindowAttribute.
Signature is:
SetLayeredWindowAttribute(handle, color, transparency, LWA_ALPHA)
Parameters:
handle -> Your window handle (hWnd)
color -> Optionall set this to color that you want to be transparent or NULL
LWA_ALPHA -> constant for transparency
Try it out it worked for me. Moreover have a google out on this you will definitely get the source code too. (I got it in the same fashion
I work on the same thing that you, but I cannot answer you for the moment I have a problem :
Alpha blending or color keying are applied
to my title bar but not on my opengl content.
Can you show me your PIXELFORMATDESCRIPTOR and any thing else to help me? Perhaps together we will find a good solution.
try to render into a bitmap and redraw the window with that bitmap using a all black mask that you render into a bitmap
useing a bunch of bltbit calls you can draw it and use like black as your transparent mask color
i dought you will get really high framerates, but it is possible
to get rid of the flicker you make have to use a memory dc to render into and copy that into a dib and copy that into the window’s dc
there is going to be alot of steps involved per frame in this, and it will stress out the graphics accelerator
but it would be useful for something like a desktop pet dog or something like that
since you could use a model made in a 3d editor and just render it