Rendering to a texture...

Started by
2 comments, last by LemonLime 18 years, 10 months ago
Hi, I need to render to a texture, that will also be rendered. From what I can gather from the help, it is only possible to render to a surface, and a surface cannot be used as a texture.

IDirect3DDevice9::SetRenderTarget(DWORD RenderTargetIndex,IDirect3DSurface9 *pRenderTarget);

IDirect3DDevice9::SetTexture(DWORD Sampler,IDirect3DBaseTexture9 *pTexture);
Do I need to copy the surface to a texture (although this would be slow), or is there another way? Thanks for any help.
"Segregation or Supernova? YOUR MOVE..." - The Holy Ghost
Advertisement
Have a look at codesampler

v good site!

Simon
Basically just create a texture with a supported surface format and then call surface = texture.GetSurfaceLevel(0); to get the surface and use it with device.SetRenderTarget(0, surface); (you might also want to set a new depth stencil surface in case you don't want your original overwritten or use bigger texture sizes).
Microsoft DirectX MVP. My Blog: abi.exdream.com
Thanks to you both.

It was the GetSurfaceLevel() that I was missing.
"Segregation or Supernova? YOUR MOVE..." - The Holy Ghost

This topic is closed to new replies.

Advertisement