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

Started by
1 comment, last by CDProp 15 years, 10 months ago
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?
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().
NextWar: The Quest for Earth available now for Windows Phone 7.
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.

This topic is closed to new replies.

Advertisement