OffscreenRenderer

class pyrender.offscreen.OffscreenRenderer(viewport_width, viewport_height, point_size=1.0)[source]

Bases: object

A wrapper for offscreen rendering.

Parameters:
  • viewport_width (int) – The width of the main viewport, in pixels.
  • viewport_height (int) – The height of the main viewport, in pixels.
  • point_size (float) – The size of screen-space points in pixels.

Attributes Summary

point_size The pixel size of points in point clouds.
viewport_height The height of the main viewport, in pixels.
viewport_width The width of the main viewport, in pixels.

Methods Summary

delete() Free all OpenGL resources.
render(scene[, flags, seg_node_map]) Render a scene with the given set of flags.

Attributes Documentation

point_size

The pixel size of points in point clouds.

Type:float
viewport_height

The height of the main viewport, in pixels.

Type:int
viewport_width

The width of the main viewport, in pixels.

Type:int

Methods Documentation

delete()[source]

Free all OpenGL resources.

render(scene, flags=0, seg_node_map=None)[source]

Render a scene with the given set of flags.

Parameters:
  • scene (Scene) – A scene to render.
  • flags (int) – A bitwise or of one or more flags from RenderFlags.
  • seg_node_map (dict) – A map from Node objects to (3,) colors for each. If specified along with flags set to RenderFlags.SEG, the color image will be a segmentation image.
Returns:

  • color_im ((h, w, 3) uint8 or (h, w, 4) uint8) – The color buffer in RGB format, or in RGBA format if RenderFlags.RGBA is set. Not returned if flags includes RenderFlags.DEPTH_ONLY.
  • depth_im ((h, w) float32) – The depth buffer in linear units.