Open Source Platform
for interconnected virtual worlds

Content Scripting Python Viewport

From RexWiki

The following example function shows how to enable additional viewport when prim is touched:

def EventTouch(self,vAvatar):
    vAvatar.rexSetViewport(command, viewportName, posX, posY, width, height)
Another viewport on the right side of the window

Where:

  • command: 0 to remove existing viewport (by name), 1 to add new viewport.
  • viewportName: Unique identifier for the viewport.
  • posX: screen relative position of the left edge of the viewport
  • posY: screen relative position of the top edge of the viewport
  • width: screen relative width of the viewport
  • height: screen relative height of the viewport

The dimensions are relative, where [0,0] is top left of the screen and [1,1] is bottom right of the screen.

Viewport and a render-to-texture camera

Camera

The viewport by default uses the existing camera. You can make the viewport use another camera by using RTT Camera. In that case the rtt camera rendering is disabled and only the actual camera is used by the viewport. When either the viewport or the rtt camera is removed, both the viewport and the rtt camera are removed.

To use different camera:

  • First create the viewport with the above script command.
  • Create an rtt camera with the same name as the viewport.

For controlling the camera, see the camera section in the RTT Camera article.