Jump to content
  • Advertisement
Sign in to follow this  
spedmen

Split Screen Programming

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

Hello, I am currently programming a "Tron" like game, with two superbikes driving around a set arena, I would like to have a camera follow each of the two players. Is there a tutorial/guide I can look at, or any helpful advice would be great, thanks!

Share this post


Link to post
Share on other sites
Advertisement
In OpenGL, viewports are very trivial to set up and use. All you need to is provide the corner and dimensions to glViewport(), and then give the correct aspect ratio (width/height) when generating your perspective projection.

Share this post


Link to post
Share on other sites
Just to clarify - viewports are not restricted to OGL/DX. "Viewport" is simply a term used to describe the use of cameras in a game scene. So you have a single scene that contains all of your objects, so in your case your scene would have the two bikes, your grid-like environment (arena) and any walls already created by the superbikes as they race around. That single scene can then be rendered from multiple angles with viewports. When you set the parameters for a viewport, you're deciding what the player can see from a certain location in the scene. So for split-screen, you have two viewports side by side rendering separate viewpoints of the scene. Just imagine it like those security camera monitors, the ones where you see 4 images on one screen, but they're all of the same room, just different angles.

Share this post


Link to post
Share on other sites
Thanks for the help!

I got split screen working in DirectX, but I am having problems with getting my cameras to show everything properly, I am not sure what is wrong as I tried using the projection matrix with the same viewport settings, and with different viewport settings, all I want is first to show the same bike (both cameras pointing at 1 bike at the moment) in correct dimensions on both top and bottom, but only the top is working properly.

DirectX Screenshot

Share this post


Link to post
Share on other sites
that doesn't look too far off. This looks like a aspect ratio / fov problem. Check those values in the two projection matrices, they should be identical.

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!