View Full Version : desktop background opengl
02-02-2005, 03:30 AM
I have some spare time and want to do smth to desktop. i'm trying to render a opengl scene to my desktop using GetDC(0). NO luck. I was wandering is it possible to write to this context or shoud i use some other method. any help is good :) )
Problem: how to render (or draw) a picture to a windows desktop (wallpeper)? with directx or opengl, gdi, anything :)
02-02-2005, 05:57 AM
This attempt is doomed using OpenGL.
There are two problems:
First, the desktop window does not belong to your app's process. Drawing into other processes' windows is a security problem and must not be allowed by the driver. (Vendors which allow this do the wrong thing and apps relying on it, too.)
The second problem is that under Windows you need to SetPixelFormat on the window you want to render to. This works exactly once! Read the MS manual. Means if you do this on the desktop window, and your driver actually succeeds, your program will only work for the first time and never again until reboot, because the desktop window cannot be destroyed.
You can try to render onto a transparent window which you always make the bottom one in the z-order of the open windows.
Or you could trick something with web features on the desktop, but I didn't care about those.
02-02-2005, 10:11 AM
There is a NeHe's lesson that explain very correctly the SetPixelFormat
But I suppose the MSDN is not a bad solution :-p
02-02-2005, 11:54 PM
Thnx ppl. transparent window it will be. But here comes another question, is it possible to make window be at the bottom even if it is selected, so that all icon etc are visible?
02-03-2005, 04:02 AM
Here is a another solution... Render to offscreen pbuffer, grab result in sys memory and then copy frame to directshow graph with one source and one renderer filter. Renderer filter should have overlay and change desktop color to overlay color key.
Place renderers window to be a fullscreen window behind all other windows.
Anyway.. take a look in vis plugin in Winamp. Open Settings/Display and check overlay mode and SetDesktop to color.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.