Split Screen Programming
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!
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.
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.
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.
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement