Jump to content
  • Advertisement
Sign in to follow this  
CDProp

Does IDirectX9::CreateDevice() create a render target for you?

This topic is 3762 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 think I am a little confused. If I'm not mistaken, a Render Target is a surface that you can instruct DirectX to render to. So, this can either be an off-screen surface or an on-screen surface (back buffer, or whatever). I'm browsing through MSDN to find more details on this. It looks like the device interface has some methods for creating and setting a render target. My confusion stems from the fact that I have never called this functions, yet I am able to run my demos just fine. When I create a device using the IDirectX9 interface, is this method using the PresentParameters to create the render target for me (the on screen surface with back buffer) and setting it on my behalf? Or are the onscreen/backbuffer surfaces not considered a render target per se?

Share this post


Link to post
Share on other sites
Advertisement
Direct3D will automatically create the swap chain - this is comprised of a frontbuffer and a backbuffer if you're using double buffering. By default, the render target is set to the backbuffer. This is why you don't need to set it using the various other functions. You can retrieve the backbuffer as a rendertarget surface by calling IDirect3DDevice9::GetSwapChain() to get the swap chain, then calling IDirect3DSwapChain9::GetBackBuffer().

Share this post


Link to post
Share on other sites
Cool, thanks! I'm wanting to abstract the render target thing a little. Each render list in my program will have its own target, and it could be the back buffer, or it could be an off-screen surface, or it could be just a small window within the back buffer, or whatever. So, it'll need to keep track of which DirectX render target its using, along with its view port, and some other info. Thanks for your help.

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!