Split-Screen

Hi everybody,

I’m trying to create a split-screen game.
I first tried it using the bufferViewer, but that didnt work because I can only have one of that.
So, I made two buffers, one for each player, and did two onscreenimages with as image the texture of the camera that belongs to that player.
I put the texture on an OnscreenImage.
It runs great, except for the fact that it is REALLY bad quality.
Does anyone have another idea?

Maybe you should check out how pview does it when you press the 2 key. That works pretty well.

Thanks for your reply.
Yeah, I saw that.
One problem. pview is programmed in C++. pview uses the WindowFramework, which is unfortunately only available in C++. And that while I’m trying to create this game using Python.
Is there any alternative?

Just open a new window, for instance with base.openWindow(). I’m pretty sure there are a number of forum threads that talk about doing this sort of thing.

Depending on what you want to display in the second window, you can then either reparent or reposition the window’s camera, or pass makeCamera = 0 and create your own DisplayRegion and camera.

David

Thank you for your quick reply, David.

The way you suggested opens a second window. But I don’t need a second window, but I just need to display the views of two camera that I already have on 1 window. Isn’t there an easier way that using two onscreenimages?

EDIT:
I found this post on the forum:
discourse.panda3d.org/viewtopic … 24d8246f66
Or is this something entirely else?

Oh, sorry–I misunderstood, since you were talking about buffers, I assumed you wanted to display something in a separate window.

If you just want to subdivide one window, you don’t need to mess with any of that. You just create a new DisplayRegion. By default, you get one DisplayRegion that covers the whole screen. You can throw that one away (or change its placement) and create any number of DisplayRegions wherever you like. Each one is a rectangular are of the screen that you render into, and each one has a different camera.

The referenced thread is a fine example.

David

David, thank you very much for your reply. It works great now.

Except one thing: the views are stretched now. My character is twice as thin :wink: Is this related to the FOV of the camera?

EDIT: never mind, I found out. I just had to set:
self.camera.node().getLens().setAspectRatio(3.0/4.0)