Skip to main content
GameDev.net gamedev.net
🔒 Locked

DirectX Desktop

Started by SlickKobra Aug 22, 2008 at 11:28 PM 9 replies 3.5k views
Original Post
SlickKobra
SlickKobra
Hey guys, is it possible to use the API mentioned in the title on the desktop? If so please post some tutorials on what needs to be done in order to do that, unless it can be easly be done using a few functions or something :). Thanks.
Evil Steve
Evil Steve
Firstly, what component of DirecX? Direct3D? DirectX covers all sorts of things.

Secondly, what do you mean by "use the API mentioned in the title on the desktop"? Can you give an example? Do you mean you want to render directly onto the desktop? I don't think that's possible, because the desktop window isn't owned by your process (Unless you want to inject code into explorer.exe, but that's going to be a nightmare and will likely set of every virus scanner on the planet). You could probably fake the effect by creating a transparent window over the desktop, and rendering onto that.

Can you give an example of what you're trying to achieve?
SlickKobra
SlickKobra
Well I don't plan to do anything yet but just in case I do I need to know how to do it. Anyways some examples could be:

- The the mouse pointer has a fire trail
- The desktop and only the desktop has a rotating cube rendered on it at all times
- The screen has a rotating cube rendered at the centre at all times

Which ones are possible to do using Direct3D?
Evil Steve
Evil Steve
Quote:
Original post by SlickKobra
Well I don't plan to do anything yet but just in case I do I need to know how to do it. Anyways some examples could be:

- The the mouse pointer has a fire trail
- The desktop and only the desktop has a rotating cube rendered on it at all times
- The screen has a rotating cube rendered at the centre at all times

Which ones are possible to do using Direct3D?
The last one would be relatively easy to do with a transparent window in the middle of the screen. However, if the user tried to click on something behind that window, your window would take the focus and the input wouldn't get passed through.

The first two may be best done by writing an explorer replacement, but that's probably a bit overkill.

Anything you can do with Windows you'll be able to extend to use D3D. So if you can find a way to give the mouse pointer a fire trail using WIn32 and GDI, the same concept should work with D3D.
I'm not really sure about this, so I'll shut up and see if anyone else has any ideas [smile]
SlickKobra
SlickKobra
Hehe :). Suddenly I feel a little disappointed because I hoped that I would be able to create games as well as make use of special effects on the operating system for some of my programs... Well let's just see if anyone knows anything.
Johnny Sunshine
Johnny Sunshine
Maybe this can help you:
http://www.angelcode.com/dev/overlay/

This is a program which renders directly to your desktop using DirectDraw. I'm not sure if this is what you need (it uses DirectDraw, not D3D, renders only under icons), but it shows that it is certainly possible to do your second example, and might give a starting point.

You might also want to check this one too:
http://www.angelcode.com/dev/desktopdraw/

As for fire trails, my only idea would be to use multiple topmost windows as particles and a mouse hook -- but I imagine it would be full of Windows hacks and I'm also unsure about the performance of this method.

But, if you want fire only on the desktop, then the second example is your best bet.
legalize
legalize
You can do all those things with Direct3D. However, you need to understand that DirectX and GDI really do live in separate worlds and barely know how to talk to each other. For the effects you're describing, you're probably better off doing them in GDI; Direct3D isn't going to buy you a whole lot because you'll need to deeply integrate with GDI in order to get this stuff on the screen anyway, so any performance benefit/ease of rendering you might have obtained from Direct3D is pissed away by the coupling to GDI.
tehXKnight
tehXKnight
Vista has the ability to set a video as the wallpaper. It's only built into Vista Ultimate, but MS worked with Stardock to get it up and running and they have it working on all versions of Vista I believe. Deskscapes It also allows you to render things in real-time to the wallpaper. One of the "wallpapers" that come with it is a spinning cube rendered real time.

As for the sparkly mouse... I know there are ways to track the mouse movement. You could set up a service that recieved all mouse input and rendered a particle stream there, but you'd probably be better off with GDI and just using some sort of animated texture that you faded out. Still as a service of course.
Evil Steve
Evil Steve
Quote:
Original post by tehXKnight
Vista has the ability to set a video as the wallpaper. It's only built into Vista Ultimate, but MS worked with Stardock to get it up and running and they have it working on all versions of Vista I believe. Deskscapes It also allows you to render things in real-time to the wallpaper. One of the "wallpapers" that come with it is a spinning cube rendered real time.
I should point out that Vista is slightly different; It uses D3D to render the whole desktop (Which is how it does the Aero Glass effects, etc). That makes it easier to do 3D effects in Vista (in theory).

Quote:
Original post by tehXKnight
As for the sparkly mouse... I know there are ways to track the mouse movement. You could set up a service that recieved all mouse input and rendered a particle stream there, but you'd probably be better off with GDI and just using some sort of animated texture that you faded out. Still as a service of course.
You wouldn't need a service to do this, you can use a system-wide mouse hook (See SetWindowsHookEx) to capture all mouse input, and then do whatever you want. It's actually harder to get a service to interface with the desktop (or any GUI) than it is for a normal application [smile]
Neverender
Neverender
Along the lines of Vista's hardware accelerated desktop composition, there's an interesting article over at CodeProject on how to tap into some of the D3D9Ex and DWM stuff that's available in order to get yourself a 100% "client area" (borderless) Direct3D window with alpha blending onto the desktop (!).

http://www.codeproject.com/KB/directx/umvistad3d.aspx
px
px
Quote:
Original post by Evil Steve
The last one would be relatively easy to do with a transparent window in the middle of the screen. However, if the user tried to click on something behind that window, your window would take the focus and the input wouldn't get passed through.


Actually, I believe windows with the WS_EX_TRANSPARENT extended style will have clicks fall through to whatever is underneath it. That flag combined with WS_EX_LAYERED would be made of win for this idea.

@SlickKobra: You may or may not find this article from Microsoft interesting if you wanna go down that road.
Humble people don't refer to themselves as humble (W.R.T. "IMHO".)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.