Sign in to follow this  

RenderTarget vs BackBuffer for Offscreen rendering

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

I do only offscreen rendering. What I do now is render to a backbuffer and blit to a HDC. Is there any advantage the the alternative of 1) Creating an invisible HWND of one pixel 2) The backbuffer will coreespondingly be a single pixel. 3) Use a render target. Other questions a have are 4) Does SetRenderTarget increment the reference count of the argument? 5) What should I use for the index argument of SetRenderTarget?

Share this post


Link to post
Share on other sites
Quote:
Original post by Constantin
I do only offscreen rendering.

What I do now is render to a backbuffer and blit to a HDC.

Is there any advantage the the alternative of
1) Creating an invisible HWND of one pixel
2) The backbuffer will coreespondingly be a single pixel.
3) Use a render target.

Other questions a have are
4) Does SetRenderTarget increment the reference count of the argument?
5) What should I use for the index argument of SetRenderTarget?
1-3: I don't really follow... If you do that, surely you'll only be able to render 1 pixel images?
4: Not sure. Call Addref() and Release() before and after and see if Release() returns a different value. However, if you're using the interfaces correctly it shouldn't matter. If you no longer needs the interface pointer, Release() it. If not, don't.
5: 0. You'd only use non-zero if you're using multiple render targets - which aren't supported on all cards, and aren't of any use to you in this case.

Share this post


Link to post
Share on other sites
I come from opengl world. But I don't see why render targets should be any different in D3D.

Your render target is just like your default back buffer, only it's a different one. Don't create another device just to get it's buffer, just use another render target.

For SetRenderTarget, after a quick search it looks like the parameters are surfaces, which must be the d3d term for a buffer. And the index it looks like is used for MRT which is Multiple Render Targets. It's like having multiple buffers attached at the same time. Which shouldn't concern right now unless you're using shaders and want to get fancy. So just pass zero. You may want to pass null for the zstencil buffer as well. That is just a hunch.

Are you making a 2D game? Or some kind of application that just needs to draw something?

Share this post


Link to post
Share on other sites
The advantages of using a render target over a back buffer are in flexibility. The back buffer formats are a subsets of the render target formats, and it's possible that there is also a size limitation to the back buffer that has to do with the display size.

Share this post


Link to post
Share on other sites

This topic is 3493 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.

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