Python example: mrpt_opengl_example.py
Off-screen rendering of a 3D scene into an image with mrpt.opengl.
Modules: mrpt.opengl
1#!/usr/bin/env python3
2"""
3Off-screen rendering of a 3D scene into an image with mrpt.opengl.
4
5Demonstrates:
6 - CFBORender: off-screen OpenGL framebuffer renderer
7 - CFBORenderParameters: configuration struct
8
9NOTE: Actual rendering requires an OpenGL/EGL context.
10 This example only exercises object construction and parameter access.
11"""
12
13import mrpt.opengl as ogl
14
15# ---------------------------------------------------------------------------
16# CFBORenderParameters
17# ---------------------------------------------------------------------------
18params = ogl.CFBORenderParameters(640, 480)
19params.raw_depth = False
20print(f"FBO params: {params.width}x{params.height}, raw_depth={params.raw_depth}")
21
22# ---------------------------------------------------------------------------
23# CFBORender construction
24# ---------------------------------------------------------------------------
25fbo = ogl.CFBORender(640, 480)
26print(f"CFBORender: {fbo.width()}x{fbo.height()}")
27print(f" hasCameraOverride: {fbo.hasCameraOverride()}")
28
29# Clear any override
30fbo.clearCameraOverride()
31print(f" after clearCameraOverride: {fbo.hasCameraOverride()}")
32
33print("\nAll mrpt.opengl examples passed.")