Render RenderTarget to backbuffer

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Valmond
Posts: 308
Joined: Thu Apr 12, 2007 3:26 pm

Render RenderTarget to backbuffer

Post by Valmond »

Hi!

I'll try to make one or two effects from GpuGems so I'll need to render the scene
to a RenderTarget, do the effects and then 'blit' this RenderTarget to the backbuffer.

So I'll try to use

Code: Select all

addRenderTargetTexture(...
setRenderTarget(...
Draw everything + effects

But then comes the problem, how do I copy the Texture to the Backbuffer?

It seems a bit quirky to make a quad, place the render target texture on it and render it to the
back buffer (I bet there will be filtering issues etc too) so anyone knows how this can be done better?

You do need to blit the pixels right or can you just 'set' the output to the render target texture?


Thanks!
jpoag
Posts: 25
Joined: Mon Aug 10, 2009 1:00 am

Post by jpoag »

Yeah, I think that's how it works: you create a quad the size of the screen and use the rendertarget as the texture. You will probably have to play with the world and view transforms (set them to identity).

Look at the 'Draw2DImage' code in the driver. It sets up the device to render in 2d. I assume you'll want to add a pixel shader to the mix...


Also, take a look at this PostProcessingclass. It creates a chain of effect (which is probably more than you're looking into) but gives an example of rendering to a texture and then using the texture to render to the bacbuffer.
-James
Valmond
Posts: 308
Joined: Thu Apr 12, 2007 3:26 pm

Post by Valmond »

Thanks all!

>Devsh
So there are no filtering if you pass by a vertex shader only... OK!

(BTW, top left frame freezes on my E8400 8800GT too).
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Post by devsh »

Yeah I know

but still they are releasing 1.6 with the bug! I think
Valmond
Posts: 308
Joined: Thu Apr 12, 2007 3:26 pm

Post by Valmond »

Yeah, gotta find it first ;-)
Post Reply