Implementation:Google deepmind Mujoco Filament Render Context Header
| Knowledge Sources | |
|---|---|
| Domains | Rendering, C API |
| Last Updated | 2026-02-15 04:00 GMT |
Overview
Declares the C API for the Filament rendering backend, including context creation, rendering, pixel readback, texture upload, and GUI integration functions.
Description
render_context_filament.h is the public C header that defines the Filament rendering backend interface for MuJoCo. It declares the mjtGraphicsApi enum (mjGFX_DEFAULT, mjGFX_OPENGL, mjGFX_VULKAN), the mjrFilamentConfig struct (native window handle, graphics API selection, GUI enable flag), and a set of MJAPI functions that mirror the standard MuJoCo rendering API: mjr_makeContext, mjr_freeContext, mjr_render, mjr_readPixels, mjr_uploadMesh, mjr_uploadTexture, mjr_setBuffer. Additional functions handle Filament-specific initialization (mjr_makeFilamentContext), GUI image upload (mjr_uploadGuiImage), GUI updates (mjr_updateGui), and frame rate queries (mjr_getFrameRate).
Usage
Included by the platform Renderer class and any code that needs to initialize or interact with the Filament rendering backend. The header is wrapped in extern "C" for C compatibility.
Code Reference
Source Location
- Repository: Google_deepmind_Mujoco
- File: src/experimental/filament/render_context_filament.h
- Lines: 1-80
Key Functions
void mjr_defaultFilamentConfig(mjrFilamentConfig* config);
void mjr_makeFilamentContext(const mjModel* m, mjrContext* con, const mjrFilamentConfig* config);
MJAPI void mjr_defaultContext(mjrContext* con);
MJAPI void mjr_makeContext(const mjModel* m, mjrContext* con, int fontscale);
MJAPI void mjr_freeContext(mjrContext* con);
MJAPI void mjr_render(mjrRect viewport, mjvScene* scn, const mjrContext* con);
MJAPI void mjr_readPixels(unsigned char* rgb, float* depth, mjrRect viewport, const mjrContext* con);
MJAPI void mjr_uploadMesh(const mjModel* m, const mjrContext* con, int meshid);
MJAPI void mjr_uploadTexture(const mjModel* m, const mjrContext* con, int texid);
Import
#include "experimental/filament/render_context_filament.h"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| config | mjrFilamentConfig* | Yes | Rendering configuration (native window, API, GUI flag) |
| m | const mjModel* | Yes | MuJoCo model for context initialization |
| con | mjrContext* | Yes | Render context to initialize or query |
Outputs
| Name | Type | Description |
|---|---|---|
| Initialized context | mjrContext | Populated rendering context with Filament backend |
| rgb/depth | unsigned char*/float* | Pixel data from readback operations |