views:

91

answers:

3

I would like to get at the raw image data, as in a pointed to a byte array or something like that, of the image output from a direct3d app without actually rendering it to the monitor.

I need to do this so that I can render direct3d as a directshow source filter

Visual studio 2008 c++

A: 

Use a render target?

MSN
+1  A: 

Create a surface to which you're going to render as an instance of IDirect3DSurface9. Set it as the target for your rendering with IDirect3DDevice9::SetRenderTarget.

Jerry Coffin
So in a nutshell, I would call the setrendertarget in the initialization, and then after each frame is rendered. LockRect to get a D3DLOCKED_RECT which would provide me a pointer to the image bytes? Is that it in a nutshell?
Mr Bell
Oh and calling setrendertarget will prevent it from being rendered to the screen, yes?
Mr Bell
A: 

You can also lock the back buffer.

DeadMG
I am not very familiar with d3d. How would I lock the back buffer to get at the pixel data?
Mr Bell
http://msdn.microsoft.com/en-us/library/bb174379(v=VS.85).aspxhttp://msdn.microsoft.com/en-us/library/bb205896(v=VS.85).aspx
DeadMG