Sign in to follow this  
Keba

Render To texture question

Recommended Posts

Ok, i'm not sure how to render to texture. i wan't to render my scene to a texture and then display the texture on a quad. I have seen examples of this with effects that are doing it in two passes...but how should i handle the rendertarget switch? should i use multiple rendertargets to create this effect? or should i create a additional rendertarget and switch between the main rendertarget and my new rendertarget? You can't change rendertarget between two passes...right? or? something like this:

// Sceen render to texture

Clear(D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER)

	BeginScene()

		GetRenderTarget(main rendertarget)
		SetRenderTarget(new rendertarget)
		RenderSceen();
		SetRenderTarget(main rendertarget);
	EndScene()

// quad render



Clear(D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER)

	BeginScene()
		Render Quad with texture;
	EndScene()

Present();



above is not possible to do in a effect with two passes... maybe there is a better solution than this, my question is: how to performe render to texture in the "correct way"

Share this post


Link to post
Share on other sites
You can have a look at this page:
http://www.riemers.net/Tutorials/DirectX/Csharp3/Render_To_Texture.php


It's in C#, but you'll get the idea

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