View Full Version : To draw and animate an object with a transparent background over the windows desktop
06-20-2002, 07:19 AM
Someone know how to draw and animate (with high rate) an opengl object with a transparent background, over the windows desktop for exemple?
06-20-2002, 07:27 AM
As far i know: you can't do this.
however, you can fake it when you store your background in a buffer before you create your openGL window, and copy your buffer into a texture and instead of clearing the backgound color just draw a polygon textured with this texutre.... but this works only when your background does not change.
06-20-2002, 08:31 AM
Well, another possibility would be to create an OpenGL device with the desktop's DC. On the first frame you could copy the region of the framebuffer into a texture and animate it then, but well, something like:
your window is at front and in the background an animation is running is impossible as far as I know
06-20-2002, 09:05 AM
Under *nixes and win32 it's not possible.
You could maybe achive that under Mac OS X ( alpha blending in desktop ).
06-20-2002, 12:58 PM
Windows does allow you to create odd shaped windows. You need to use the function SetWindowRgn (Set Window Region). I have no idea if it will work with an OpenGL window, or what bits you have to set on the window (i.e., CLIP_PARENT and the like).
If it did work you would get the siloette of what you where rendering in 2D window coordinates, send them to the function CreatePolygonRgn. Then use attach the HRGN returned by using SetWindowRgn.
I would recommend using the smallest window possible, because I bet that you will get quite a bit of flickering otherwise. I bet
that a method similar to this is used for the Microsoft Agents that come with Office.
Oddly, I can't find a function that creates a region using a bitmap, which would allow you to download the OpenGL framebuffer and use it directly to create the region instead of using siloette polygons, which is probably not trivial. I wish I knew more about GDI. Maybe the PaintRgn function would work...
Also, if you can look up the equivalent GDI+ functions which work in Win2k and XP they may be better and more flexible.
Windows 2000 and XP have alpha blending through GDI+ (just look at the shadow under the mouse cursor), so its not just Macs, but I don't think that is what you want.
I am almost certain that the 'pixel ownership test' on Windows 2k/XP would include the window region. SwapBuffers for a less than full screen window pretty much has to be a blit from the backbuffer, and this blit obeys every other thing which clips it (like other windows).
06-20-2002, 01:04 PM
I realize that you may not have MSDN installed to look up all those functions I mentioned, so here is a URL I found.
Or, you could enter 'non rectangular windows' into Google.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.