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:


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.


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


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):
    base.camNode.setActive(False) #disable default cam

def createCamera(self,dispRegion):
    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).


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…


  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:


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: