Getting the screen, and cutting a part out


I’d like to capture the current screen (basically a printscreen of the active panda window) and cut out a part I need, and display that on-screen. It’s based on the Game Maker principle, where the same thing is done with Views. Is this possible in Panda? And if it is, can someone give me some samples / classes / links so I have an idea where I can start? Something like a Graphics class in C# :slight_smile: I’m using Python in combination with Panda :wink:

Thanks in advance,

Hi, and welcome to the Panda3D forums!

Uh, I think you’re thinking about this too complex, you’ll more likely want a realtime approach, right? You can simply get the camera’s DisplayRegion and adjust it’s parameters. A DisplayRegion defines where in a window (or buffer) a camera renders into, similar to GameMaker’s concept of views. I think you can make a DisplayRegion larger than the window where it’s in. Otherwise, use a scissor effect.

Scissor effects can cut out a particular part of the render output on-screen.

That’s the thing, I’d like the entire game to run in real 2D, so no camera’s but OnScreen Images. Im drawing pure 2D graphics, so there’s no need for any 3D effect. The Z axis is also left completely unused. And I know I can put the camera in such a way it looks 2D, but then I’d still need to use models, like .egg. And that’s the part I really hate :stuck_out_tongue: Just simple image drawing from a file on a x,y coördinate, and allow me to manipulate the position. And that’s exactly what OnScreenImage does. But onScreenImage doesn’t have something like views, so that’s why I’m asking this question. Any ideas? :smiley:

What about CardMaker-generated quads parented to either aspect2d or render2d? You might end up with some scaling to be done to one or both of the scenegraph root and the cards, but it should work, I think.

Actually, as Panda is a 3D engine which sends your stuff to the graphics card, anything you put on the screen is actually 3D.

Basically, there’s base.cam2d, which is an orthogonal camera that renders everything under render2d/aspect2d. When you use OnscreenImage, it actually creates two triangles with a texture applied and places it in render2d.

So in this particular case, not only altering the display region or scissor settings would work, but you could also scale and move around render2d / cam2d. :slight_smile:

EDIT: @Thaumaturge: CardMaker is nothing but a lowerlevel interface to OnscreenImage, really.