Implementation:Google deepmind Mujoco Filament Context
| Knowledge Sources | |
|---|---|
| Domains | Rendering, Graphics Backend |
| Last Updated | 2026-02-15 04:00 GMT |
Overview
Initializes and manages the Filament rendering context including the engine, renderer, swap chains, scene views, and GUI overlay for MuJoCo.
Description
filament_context.cc implements FilamentContext, which serves as the top-level orchestrator of the Filament rendering backend. During construction it selects the appropriate graphics backend (Vulkan by default on desktop, OpenGL for Emscripten), creates the Filament engine and renderer, and sets up swap chains for both window and offscreen rendering. It then initializes the ObjectManager, SceneView, GuiView, and ImGuiEditor subsystems. The context bridges the MuJoCo mjrContext API to the Filament rendering pipeline.
Usage
Created via mjr_makeFilamentContext when the application initializes rendering. The context persists for the lifetime of the rendering session and is used by all subsequent render, upload, and pixel-read operations.
Code Reference
Source Location
- Repository: Google_deepmind_Mujoco
- File: src/experimental/filament/filament/filament_context.cc
- Lines: 1-374
Key Functions
FilamentContext::FilamentContext(const mjrFilamentConfig* config, const mjModel* model, mjrContext* con);
// Selects backend: filament::Engine::Backend::VULKAN or OPENGL
// Creates engine_, renderer_, window_swap_chain_, offscreen_swap_chain_
// Initializes ObjectManager, SceneView, GuiView, ImGuiEditor
Import
#include "experimental/filament/filament/filament_context.h"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| config | const mjrFilamentConfig* | Yes | Configuration specifying graphics API, native window, and GUI enablement |
| model | const mjModel* | Yes | MuJoCo model for scene dimensions and visualization settings |
| con | mjrContext* | Yes | MuJoCo render context to populate with Filament state |
Outputs
| Name | Type | Description |
|---|---|---|
| FilamentContext | FilamentContext | Fully initialized Filament rendering context stored inside mjrContext |