Split Screen

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Sleddog
Posts: 7
Joined: Sun Aug 31, 2008 4:26 pm

Split Screen

Post by Sleddog »

How would I go about implementing split screen functionality? It seems that 2 cameras are needed, but from all indications it does not seem possible to render from 2 ICameraSceneNodes, and then take their images and combine them together for the final output. Any suggestions?
CuteAlien
Admin
Posts: 9716
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Check example 18 in the examples folder - it shows how to implement splitscreens.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Sleddog
Posts: 7
Joined: Sun Aug 31, 2008 4:26 pm

Post by Sleddog »

Thanks. I searched the forums, but not the examples lol.
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

Brainsaw
Posts: 1177
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

It's quite easy. I was surprised about how easy it is when I integrated it into my current project "Stunt Marble Racers". Here is some pseudo-code on how it works:

Code: Select all

smgr->beginScene();
driver->setViewport(viewPortOfPlayer1);
smgr->setActiveCamera(cameraOfPlayer1);
smgr->drawAll();
driver->setViewport(viewPortOfPlayer2);
smgr->setActiveCamera(cameraOfPlayer2);
smgr->drawAll();
smgr->endScene();
I hope I remembered that correctly, I don't have the code here at work. But you could check out my game (and it's sources), the splitscreen rendering is (IIRC) done in CGame::update.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Post Reply