Jump to content
  • Advertisement
Sign in to follow this  

Properly implementing split screen and using the ZBuffer.

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

First, I wanted to make sure I'm implementing my split screen correctly. I have an array of cameras and each camera stores not only its location but also its destiation rectangle on the screen. So my loop basically goes as follows: device.BeginScene(); device.Viewport = ViewportFromCamera(camera[0]); device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, colorToClearScreenTo, 1.0f, 0); DrawScene(camera[0]); device.Viewport = ViewportFromCamera(camera[1]); device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, colorToClearScreenTo, 1.0f, 0); DrawScene(camera[1]); // etc device.EndScene(); device.Present(); The problem is that my zBuffer seems to not be working when I am using viewports. If I remove all other cameras and use only one camera, and never explicitly set the device's Viewport, then the ZBuffer seems to be working perfectly. Even just keeping it at 1 camera but setting the viewport to the full screen messes up the ZBuffer. Am I missing something here? --Vic--

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!