I'm trying to get some post processing to work, by setting up a texture as a render target, drawing to it, then using it as a texture to apply a shader to and draw it to the back buffer.
This is how it should look
This is how it does look, useing the render to target method, and the exact same shaders as above.
Here how I setup the texture to be used as a render target.
result = D3DXCreateTexture((*m_d3ddev),
CGraphics->Width(), CGraphics->Height(),
D3DX_DEFAULT, D3DUSAGE_RENDERTARGET,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT,
&texture.texture);
it's created to be the same size as the backbuffer. I then aquire the surfaces like so and set the render target to be the texure.
// save the current render target
(*m_d3ddev)->GetRenderTarget(0, &m_prev_buffer);
// get and set our new render target
m_temp_texture->texture->GetSurfaceLevel(0, &m_new_buffer);
(*m_d3ddev)->SetRenderTarget(0, m_new_buffer);
// clear the texture before rendering to it
(*m_d3ddev)->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0, 0, 0, 255), 1.f, 0);
// temp texture is the IDirect3DTEXTURE9 of the texture I'll be using as a
// render target
// prev_buffer is a SURFACE representing the main backbuffer
// new_buffer is the texture surface
Am I setting the render target right, or do you need any more info?