Renderer¶
All rendering related functions and classes. The ModernGL python library is used for all rendering functions in pysg.
Base Class¶
-
class
pysg.renderer.
Renderer
(scene: pysg.scene.Scene, camera: pysg.camera.Camera)¶ Base class. All renderer implementations need to inherit form this class.
Parameters: -
ctx
= None¶ The ModernGL context object which can be used to set some OpenGL related settings. For example the context can be used to deactivate backface culling:
camera.ctx.disable(moderngl.CULL_FACE)
See https://moderngl.readthedocs.io/en/stable/reference/context.html for more information.
Type: Context
-
render
() → None¶ Base render function which needs to be implemented by sub-classes.
-
GLRenderer¶
HeadlessGLRenderer¶
-
class
pysg.renderer.
HeadlessGLRenderer
(scene: pysg.scene.Scene, camera: pysg.camera.Camera, *, width: int, height: int)¶ Render the scene to a framebuffer which can be read to CPU memory to be used as an image.
Parameters: -
current_image
() → bytes¶ Render the current scene and camera into a buffer. The buffer can later be returned with the ‘current_image’ method.
Returns: The rendered byte array. Copy from vRAM to RAM. Return type: bytes
-
render
() → None¶ Render the current scene and camera into a buffer. The buffer can later be returned with the current_image method.
-