Rendering to textures?

Started by
4 comments, last by Tom 18 years, 10 months ago
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.
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.
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.
-bump-
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.
Hack my projects! Oh Yeah! Use an SVN client to check them out.BlockStacker
Don't forget to cache the pointer to your back buffer so you can restore it when you're done.

GDNet+. It's only $5 a month. You know you want it.

This topic is closed to new replies.

Advertisement