Sign in to follow this  
DevLiquidKnight

Rendering to textures?

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
Moe    1256
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
Staffan E    536
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
Tom    352
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this