• Advertisement
Sign in to follow this  

Rendering to textures?

This topic is 4606 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

I was wondering if anyone knows any places I can find a directx 9.0c example of taking a texture and rendering things to it such as other objects which is done in some games? (decals) stuff like this? could someone put me into a direction of an article.

Share this post


Link to post
Share on other sites
Advertisement
I think decals don't necessarily use rendering to a texture. They generally use a transparent quad put over the surface where the decal is supposed to be. This might be of use to you though.

Share this post


Link to post
Share on other sites
This is ok I guess, I was kinda wondering how one would draw textures over textures, that type of thing.

Or various things such as this; perhaps to use quads to draw a game on them by drawing a texture on a texture.

Share this post


Link to post
Share on other sites
Some of the provided SDK samples use render to texture techniques. Have you checked them out? The DepthOfField sample outlines the process briefly in the documentation. The steps are the following.

1. Create a new texture with the D3DUSAGE_RENDERTARGET usage flag set using D3DXCreateTexture( ).
2. Get it's surface (or one of it's surfaces if multisurface texture) with IDirect3DTexture9::GetSurfaceLevel( ).
3. Set this surface as the render target either manually with IDirect3DDevice9::SetRenderTarget( ) or using the ID3DXRenderToSurface interface. Don't forget to setup viewport and stuff like that before rendering.
4. Render to the surface of the texture as you would render to a backbuffer.

Stay sharp.

Share this post


Link to post
Share on other sites
Don't forget to cache the pointer to your back buffer so you can restore it when you're done.

Share this post


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

  • Advertisement