Original Post
🔒 Locked
rendering multiple viewports
Advertisement
There are two ways to do what you want.
Firstly, Fullscreen mode
This is the simplest way of doing things - I've used it a few times before and its worked well for me. Also, as per the documentation: Note that any given device can support only one full-screen swap chain.
Look into the D3DVIEWPORT9 structure - setting this to represent the portion of your screen that you currently want to render.
So, if you want split-screen (say, top and bottom halves) then configure a D3DVIEWPORT9 to represent the top-half of your screen (the Width and Height fields are in pixels) and then commit it to the device using IDirect3DDevice9::SetViewport( ). Now render everything you want to appear in the top-half of your screen.
Now, do a similar option, but configure the D3DVIEWPORT9's Y parameter to represent the bottom half of your screen. Render everything again as appropriate.
Secondly, Windowed mode
You are on the right track by looking at 'swap chains' (IDirect3DSwapChain9 more specifically).
Typically what you'd do is create additional hWnd's so that you can specify them in the D3DPRESENT_PARAMETERS::hDeviceWindow field.
It's been a while since I've done this, but iirc, you use the various IDirect3DSurface9 pointers exposed by IDirect3DSwapChain9 as inputs to your current IDirect3DDevice9 in order to tell D3D that you want to render to a specific window...
hth
Jack
Firstly, Fullscreen mode
This is the simplest way of doing things - I've used it a few times before and its worked well for me. Also, as per the documentation: Note that any given device can support only one full-screen swap chain.
Look into the D3DVIEWPORT9 structure - setting this to represent the portion of your screen that you currently want to render.
So, if you want split-screen (say, top and bottom halves) then configure a D3DVIEWPORT9 to represent the top-half of your screen (the Width and Height fields are in pixels) and then commit it to the device using IDirect3DDevice9::SetViewport( ). Now render everything you want to appear in the top-half of your screen.
Now, do a similar option, but configure the D3DVIEWPORT9's Y parameter to represent the bottom half of your screen. Render everything again as appropriate.
Secondly, Windowed mode
You are on the right track by looking at 'swap chains' (IDirect3DSwapChain9 more specifically).
Typically what you'd do is create additional hWnd's so that you can specify them in the D3DPRESENT_PARAMETERS::hDeviceWindow field.
It's been a while since I've done this, but iirc, you use the various IDirect3DSurface9 pointers exposed by IDirect3DSwapChain9 as inputs to your current IDirect3DDevice9 in order to tell D3D that you want to render to a specific window...
hth
Jack
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement