Implementation:Google deepmind Mujoco mjr render
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Rendering, OpenGL, 3D_Graphics |
| Last Updated | 2026-02-15 06:00 GMT |
Overview
Concrete tool for rendering a 3D scene to an OpenGL framebuffer provided by the MuJoCo rendering API.
Description
The mjr_render function renders the contents of an mjvScene into the specified viewport rectangle of the active OpenGL framebuffer. It handles the full rendering pipeline: shadow mapping, 3D geometry with lighting, transparency, skybox, and fog. Works with both on-screen window buffers and offscreen FBOs.
Usage
Call after mjv_updateScene to render the current frame. Use with mjr_setBuffer to target offscreen rendering.
Code Reference
Source Location
- Repository: mujoco
- File: src/render/render_gl3.c
- Lines: 818-905
Signature
void mjr_render(mjrRect viewport, mjvScene* scn, const mjrContext* con);
Import
#include <mujoco/mujoco.h>
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| viewport | mjrRect | Yes | Render rectangle {left, bottom, width, height} |
| scn | mjvScene* | Yes | Abstract scene to render |
| con | const mjrContext* | Yes | GPU rendering context |
Outputs
| Name | Type | Description |
|---|---|---|
| framebuffer | OpenGL | Rendered pixels in the active framebuffer at the specified viewport |
Usage Examples
// Get viewport and render
mjrRect viewport = {0, 0, 0, 0};
glfwGetFramebufferSize(window, &viewport.width, &viewport.height);
mjr_render(viewport, &scn, &con);
glfwSwapBuffers(window);
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment