2 player 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
Robin

2 player split screen

Post by Robin »

I was wondering how you could make a 2 player split screen game in irrlicht, should it be done trough the viewfustrum, or are there other ways to do this? if trough the viewfustrum, how? because i am working on this but not getting anyware. (must be my lack of, and rusty programming skills)
greetz. Robin
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

You could do this with IVideoDriver::setViewPort(). In this way:

Code: Select all

while(engine->run())
{
   driver->setViewPort(leftPartOfScreen);
   sceneManager->setActiveCamera(player1Camera);
   sceneManager->draw();

   driver->setViewPort(rightPartOfScreen);
   sceneManager->setActiveCamera(player2Camera);
   sceneManager->draw();
}
Robin

2 player split screen

Post by Robin »

im sorry for this late reply, but I was kind off busy. I tried the code niko(above) gave me(Thanks niko!), but I can't get this to work. I assume that sceneManager->draw is a pointer to the function sceneManager->drawAll()
(like used in the examples) but when i write the code:

ICameraSceneNode* camera1 = 0;
ICameraSceneNode* camera2 = 0;

IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();

while(device->run())
{
driver->setViewPort(core::rect<s32>(0,0,320,480));
smgr->setActiveCamera(camera1);
driver->beginScene(true,true,SColor(0,100,100,100));
smgr->drawAll();
driver->endScene();

driver->setViewPort(core::rect<s32>(320,0,640,480));
smgr->setActiveCamera(camera2);
driver->beginScene(true,true,SColor(0,100,100,100));
smgr->drawAll();
driver->endScene();
}
i get heavy flickering.(I think because the 2nd beginScene() is drawing a black field over the left part of the screen)
also this code produces wrong results:

while(device->run())
{
driver->beginScene(true,true,SColor(0,100,100,100));
driver->setViewPort(core::rect<s32>(0,0,320,480));
smgr->setActiveCamera(camera1);
smgr->drawAll();
driver->setViewPort(core::rect<s32>(320,0,640,480));
smgr->setActiveCamera(camera2);
smgr->drawAll();
driver->endScene();
}
with this code i get 1 good viewpord(the right one) but the left one has graphics bleeding.
the only thing that did work was when I did not call a endScene() before the next beginScene() but its obvious that this is very wrong.(my pc also didn't like it very much)
I tried to find a function to render a specific region without affecting the rest, but I could not find it.
what am I doing wrong?

Greetz Robin
Robin

2 player split screen

Post by Robin »

uhoh, i just came across the split screen tutorial... ahum, but I still dont get it, the code i wrote also used directx, and it looks the same as the one in the tutorial. is it maybe version 0.4(I didnt compile in 0.41)
Robin

2 player split screen

Post by Robin »

nope, nothing works not even the split screen tutorial(well it does work but looks a mess, like 2 level trough each other) what is wrong here? I have a
ATI radeon 7200 (64MB DDR vivo )
800 mhz AMD thunderbird
256MB SDRAM
newest ati drivers and also newest directx
compiling under visual C++ 6.0(but the specialFX binary is also not functioning.)

all other games work fine, and also the other demo's exept 3, this one and the terrain demo(get the error: too much vertices(65536)max is 65535.) fixed it by making the map smaller(in terrain.h)

and the specialFX is not allright because I get no shadows, while the cart is supporting stencilbuffers. And the wather is also gone(can only see it outside the room. )
And oh yeah, the engine will not shut down annymore in ver 0.4.1(at least not when I have called 3d functions, if you load only the gui it works fine)

I am really not getting this at all. is it my 'old' graphicscard?, if someone could tell me what is wrong I would be gratefull cause I'm stuck!

greetz Robin
stampsm
Posts: 142
Joined: Mon Nov 10, 2003 5:52 pm
Location: Las Vegas

Post by stampsm »

well i have a tnt2 and they all work like they say they should but they run really *slow* and your video card is better than mine so it is probably not your card

it sounds like something is wrong with the engine (got corrupted?) try downloading everything again to a completely different spot on your computer, such as a different partition, including replacing the dll and start from scratch

it is a little hard to figure out what is wrong with it since there are so many possiblities
if you have access to a different computer try from there and see if it will work on it. if it still doesn't you might be doing something wrong

good luck
Robin

Post by Robin »

tried to redownlod ATI drivers, directx and irrlicht ver 0.4 and 0.4.1, still the same problems, ah well, I think I'm just going to format my harddisk and do a new install of win98(with the last one I used ghost) then redownload all drivers and directx. and when it still doesnt work, I'll feed my turtle my graphics card.(and buy a new card from an other company)
stampsm
Posts: 142
Joined: Mon Nov 10, 2003 5:52 pm
Location: Las Vegas

Post by stampsm »

btw if you p**a**d your compiler it might be causing the problem, try using devcpp 5 beta ( p**a**d software does not work alot of the time, because people sometimes change it so they can p**a**d it )

even if you don't know how to use it there is a tutorial here
if devcpp compiles it just fine it is the compiler that is causing the problem

i use devcpp and it works for me. in my opinion is easier for a newbee to learn to program with devcpp.
Robin

Post by Robin »

first of all; thanks for all the awnsers! but I doubt its my compiler because one of the binaries witch came with irrlicht (specialFX) isn't working either, but I'll try it on another PC.
greetz Robin
Post Reply