Multi-viewport in Panda3D

Is there anyway to do multi-viewport in panda3D? im really interested to know how to do this for a game. :smiley:

Thanks

It’s possible, yes, using DisplayRegions.
You can call base.makeCamerato create a new camera, and as displayregion you set the area where on the screen it must be displayed.

Huh. This seems like a big gap in the sample program list. We really ought to have this.

among other things I think

hmm… alright ill give it a try. Thanks pro-rsoft. :smiley:
if i get any new info ill post it back here. :slight_smile:

Thanks , everyone’s help is greatly appreciated.

Did you make any progress here?
I’d also like to have a splitscreen display,
but the documentation isn’t very helpful.
I tried with base.makeCamera, but it doesn’t quite work.

The “Global Soccer” demo in the showcase forum should show how to do it, but the download link there doesn’t work.

Any help or working example appreciated.

Henning

In what way is base.makeCamera not working for you?

David

I recall making a split-screen car racing game long time ago.

What I did was, I disabled the main camera, then created two cameras with both different displayregions:

def __init__(self):
    self.camera1=self.createCamera((0.5,1.0,0,1))
    self.camera1.reparentTo(self.model1)
    self.camera1.lookAt(self.model1)
    self.camera2=self.createCamera((0.5,1.0,0,1))
    self.camera2.reparentTo(self.model2)
    self.camera2.lookAt(self.model2)
    base.camNode.setActive(False) #disable default cam

def createCamera(self,dispRegion):
    camera=base.makeCamera(base.win,displayRegion=dispRegion)
    camera.node().getLens().setAspectRatio(3.0/4.0)
    camera.node().getLens().setFov(45) #optional.
    camera.setPos(0,-8,3) #set its position.
    return camera

PS. also useful: this thread.

I adopted your example code to my game and it works perfectly :smiley:

Although probably one of the createCamera calls should read
self.camera1=self.createCamera((0.0, 0.5, 0,1))
otherwise both displayregions would be the same (right half of the screen).

Henning

Yeah, right, sorry. Overlooked that one.

Ooooo… yeah i did give it a try for python … works perfectly too. thanks :smiley:

but im more curious on how it works for cxx. since self.createCamera is a python command if i remember…

hmms…

  framework.open_framework(argc, argv);
  framework.set_window_title("My Panda3D Window");
  WindowFramework *window = framework.open_window();

  NodeType test = window->make_camera();

i don’t think i can do this way since the function is protected…
is there any other way?

hmmmms… :confused:

Rumi

Oooh…
seem to had stumbled on this:

PT(Camera) cam = new Camera("cam");

seems to be working for now… gonna give it a deeper experimentation :smiley:

Rumi