I want to change the shape of the desktop screen, so what are displayed on the desktop will be distorted at the same time. And the user can still operate the PC with the mouse on the distorted desktop(Run the applications, Open the "My Computer" and so on). I think I must get the projection matrix of the screen coordinate at first. Then transform the matrix, and map the desktop buffer image to the distorted mesh. Are there any interfaces which can modify the shape of the desktop screen in OpenGL or DirectX? Would you please give me some tip on it. Thank you very much in advance.
Please refer to the picture from http://oi53.tinypic.com/bhewdx.jpg
BR, Haifeng
Addition1:
I'm sorry! Maybe I didn't express clearly what I want to implement. What I want to implement is to modify the shape of the screen. So we can distort the shapes of all the applications which are run on Windows at the same time. For example that the window of "My Computer" will be distorted with the distortion of the desktop screen. And we can still operate the PC with mouse from the distorted desktop(Click the shortcut to run a program).
Addition2: The projection matrix is just my assume. There isn't any desktop projection matrix by which the desktop surface is projected to the screen. What I want to implement is to change the shape of the desktop, as the same with mapping the desktop to an 3D mesh. But the user can still operate the OS on the distorted desktop(Click the shortcut to run a program, open the ie to surf the internet).
Addition3: The shapes of all the programs run on the OS are changed with the distortion of the screen. It's realtime. The user can still operate the OS on the distorted screen as usually.
Maybe we can intercept or override the GPU itself to implement the effect.
I'm investigating GDI, I think I can find some clue for that. The first step is to find how to show the desktop on the screen.
As Window Seven with Aero renders the desktop using Direct3D API, it might be possible to hook (by using detours?) the dwm.exe
process and change the way the desktop surface is projected to the screen. As far as I know, there is no DWM API you can use to do that.
OK, first off, the link you posted to uses some complex shape, not a simple quad, so a projection matrix to get that effect won't be enough. You'll need the current desktop image as a texture and map that texture onto a mesh. Note that you still can do this with a simple quad, but it's going to give a more simplistic effect (I still suggest you try this first for debugging your setup).
How to capture the desktop contents:
There are basically two ways (APIs) to do this. The first one is old-school and will only give you a single snapshot (it's very hard to update it carefully so that you still use your desktop even after the effect started). The second one will give you more support for interaction, but doesn't work on Windows XP.
BitBlt()
-- this is what the "print screen" button on your desktop does, only it puts the image to your clipboard. Then, map that to an OpenGL/DirectX texture and proceed with the rest.How to use the desktop contents:
This involves a few steps, and the code will vary a lot based on your choice of DirectX or OpenGL.
More details:
Implementing this requires good knowledge of:
You might not have all of the knowledge it takes to implement this, so I recommend that you spend some time studying the requested APIs and planning out the data flow in your application.
Also, this post is deliberately vague. When you need more details about the different steps involved using a specific API, feel free to ask other, more focused, questions on SO!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With