Jump to content
  • Advertisement
Sign in to follow this  
physic

Capture desktop to Texture

This topic is 2561 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello all!

I want to grab Windows desktop using DirectX. In all examples desktop is grabbed to system memory: CreateOffscreenPlainSurface with D3DPOOL_SCRATCH parameter, and then GetFrontBufferData.
But I want to grab desktop from video memory to video memory (Texture). It is because I want perform ARGB->YUV conversion using pixel shader. And only after shader I want grab result to system memory.

It is possible?

Share this post


Link to post
Share on other sites
Advertisement
[font=arial, verdana, tahoma, sans-serif][size=2]I don't know if it's possible to grab the Windows desktop from video memory... (I don't think so). But what you could do is:

1. Create a texture the same size as the desktop in an initialization step[/font]
2. Capture the desktop to system memory
3. Lock the DirectX texture
4. Copy the data to the DirectX texture (watch out for the Pitch parameter of the D3DLOCKED_RECT structure)
5. Unlock the DirectX texture

Now you have your desktop in video memory and can use it for your pixel shader. I'm not sure if this helps, but I hope it does.

Share this post


Link to post
Share on other sites
[font=arial, verdana, tahoma, sans-serif][size=2][font="arial, sans-serif"][size=2]I am trying to implement fastest code for Desktop capture to h.264 file. I think copy data to system memory and back is not fastest way. If direct data transfer from video memory to video memory is not possible, I will use RGBA->YUV using CPU SSE code.[/font][/font]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!