Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw OpenGL on the windows desktop without a window

I've seen things like this and I was wondering if this was possible, say I run my application and it will show the render on whatever is below it.

So basically, rendering on the screen without a window.

Possible or a lie?

Note: Want to do this on windows and in c++.

like image 930
Yonathan Avatar asked May 29 '10 14:05

Yonathan


2 Answers

It is possible to use your application to draw on other application's windows. Once you have found the window you want, you have it's HWND, you can then use it just like it was your own window for the purposes of drawing. But since that window doesn't know you have done this, it will probably mess up whatever you have drawn on it when it tries to redraw itself.

There are some very complicated ways of getting around this, some of them involve using windows "hooks" to intercept drawing messages to that window so you know when it has redrawn so that you can do your redrawing as well.

Another option is to use clipping regions on a window. This can allow you to give your window an unusual shape, and have everything behind it still look correct.

There are also ways to take over drawing of the desktop background window, and you can actually run an application that draws animations and stuff on the desktop background (while the desktop is still usable). At least, this was possible up through XP, not sure if it has changed in Vista/Win7.

Unfortunately, all of these options are too very complex to go in depth without more information on what you are trying to do.

like image 139
SoapBox Avatar answered Oct 18 '22 06:10

SoapBox


You can use GetDesktopWindow(), to get the HWND of the desktop. But as a previous answer says (SoapBox), be careful, you may mess up the desktop because the OS expects that it owns it.

like image 41
Gregor Brandt Avatar answered Oct 18 '22 05:10

Gregor Brandt