Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Google deepmind Mujoco mjr render

From Leeroopedia
Revision as of 12:48, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Google_deepmind_Mujoco_mjr_render.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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