You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers. No questions about C++ programming or topics which are answered in the tutorials!
but in result, the transparency applies to the whole window, not just the green background
Anyone knows what's wrong?
By the way, is there other ways to make the background transparent without using color-keying? as in there is no background at all, 3D objects are just on top the desktop screen itself like a widget
Last edited by phixuannhat on Mon Aug 16, 2010 9:44 am, edited 1 time in total.
This looks like its working as intended (by Windows designers).
To have window border solid, probably you will need to grab desktop picture under your window and then render it before your transparent picture, "simulating" transparence. Of course this will not update the picture if desktop under your window or any underlying window has changed.
The only thing I can think of to do it like you want is not irrlicht related. You need to grab the desktop hdc with GetDC(0), then get the pixels around where you want to blend and blend them yourself.
Lonesome Ducky wrote:The only thing I can think of to do it like you want is not irrlicht related. You need to grab the desktop hdc with GetDC(0), then get the pixels around where you want to blend and blend them yourself.
Any sources do I need to look for? coz I'm not familiar with window programming. thanks
I actually managed to accomplish this with opengl. I almost achieved a rasonable frame rate too, but not really.
As a rendering device, I'm sure that, if it was supported by windows, could be an option; but...
You have to create the window with WS_EX_LAYERED, and really I don't think it works very well except if you create it borderless, and then you would use UpdateLayeredWindowIndirect (vista+) or UpdateLayeredWindow(XP) which takes two HDC's and copies one from your bitmap into the screen. So I created an OpenGL context that rendered just to an hBitmap in a hMemDC that was a memory-only surface... but, this resides in phsyical memory of the system not video memory, so the UpdateLayeredWindow copies from system memory into video memory; and that is VERY slow.
What I tried next was to actually render to an OpenGL context that was off-screen (4000,4000), so the buffer was already on the card, and the opengl could be done in hardware; then I used pbuffers to copy the image into system memory which I could then use UpdateLayeredWindow to output it.
It also ends up that it doesn't work without some post processing in the middle - opengl doesn't generate an alpha attribute (even along the anti-aliased edjdes) so you only end up with color component, which windows blends by addin only - so black isn't black - it's the current background plus nothing; so what you get is a progression to white... because if you have blue and out it over a yellow pixel, it will be 255,255,0 + 0,0,255 = 255,255,255 (white), and it clamps at white.
So this means that if you put your opengl animation over a white window like most explorer windows, you don't see your whites, and black doesn't make it dark, so you end up with a bit of image over the dark text.