Sign in to follow this  
spedmen

Split Screen Programming

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this