Jump to content
  • Advertisement
Sign in to follow this  
Keba

Render To texture question

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

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!