Split Screen

Started by
5 comments, last by d000hg 18 years, 9 months ago
A simple question: How can we implement split screen using DirectX
[ my blog ]
Advertisement
As I understand it either by creating two devices or using swap chains.

Both techniques are described here:
http://www.codesampler.com/dx9src/dx9src_1.htm
Another simple way is to render to multiple textures and render each texture as a slit screen.

Yout have to be aware of aspect ratio issues and what-not regardless of what method you use.

Spree
Use viewports. You should never create 2 devices in the same time. No need for swapchains or render-to-texture.

Lookup D3DVIEWPORT9 and IDirect3DDevice9::SetViewport. You basically set a viewport that covers half of the screen, render everything from the view player 1, then change the viewport to cover the other half and render everything from the view of player 2.

Do you mean split-screen on a single monitor, or using multiple monitors, one for each player?

For the first, you just want to look into Viewports. To support multiple monitors it depends if this is D3D or DDraw. For D3D you basically create a device for each monitor, attached to a window on the monitor. I have some code for this if you're interested?
One caveat with viewports is that they (or even a tiny section) can't be offscreen. VERY bad things happen. But your split-screen shouldn't have that issue if created properly.
But why would you want to? What does happen out of interest - I'd have thought SetViewport would return an error if it's going to cause rendering to break things...

This topic is closed to new replies.

Advertisement