SDL 2 Camera Issue

I’m trying to make a split screen mode that will require 2 cameras. The classic method of makibg the camera stay in place and the world noves around it wont work because player 2 will have to move that same level around HIM and it’ll just be a mess. A solution is like i said to get a camera that follows the player and not have the world move around him. btw please don’t post for me to use openGL, I’ve recently just tried it and it was a waste a time lol

a split screen mode that will use 2 cameras, and regular SDL can’t do this.

You mean like how multiplayer Halo has two people playing on the same
screen, each getting half of it (not reading input from a video camera,

This shouldn’t have anything to do with SDL; in OpenGL, you would call
glViewport to limit rendering to half the screen, render the entire
frame from the first player’s viewpoint, then do the same thing on the
other half of the screen (or quarter of the screen, however this is
split between players).

One could also render to a render target (a “framebuffer object” in
OpenGL terms), one for each player, and blit them to the screen with the
framebuffer_blit extension, or just draw the final results as a textured

If you weren’t using OpenGL, you could do something similar with SDL’s
rendering API for a 2D game.


(EDIT: you edited your post before I replied by email, so this isn’t an exact answer to your updated question, sorry.)

1 Like

Yeah the split screen is like a FPS. Could i call glOrtho in with a SDL 2 renderer? Or do i have to have a OpenGL renderer and window?


Could i call glOrtho in with a SDL 2 renderer?

Even if SDL is using OpenGL behind the scenes, I wouldn’t recommend it. Also, since SDL’s renderer only does 2D stuff, I’m not sure glOrtho is going to help you a lot anyhow.


1 Like