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 Glad Header

From Leeroopedia
Knowledge Sources
Domains OpenGL, Graphics, Rendering
Last Updated 2026-02-15 04:00 GMT

Overview

Header file declaring OpenGL types, constants, function pointer typedefs, and the MuJoCo-prefixed OpenGL loader API.

Description

This header provides all the OpenGL type definitions, enumerations, and function pointer declarations needed by MuJoCo's rendering subsystem. It replaces the standard OpenGL headers and uses the mjGlad_ prefix to avoid symbol collisions with other OpenGL loaders. The header declares function pointers for OpenGL 1.0 through 1.5 core functions and several ARB/EXT extensions including framebuffer objects, clip control, depth buffer float, seamless cube map, vertex buffer objects, sRGB textures, and KHR debug.

Usage

Included by any MuJoCo source file that needs access to OpenGL functions. It must be included instead of standard OpenGL headers (gl.h) to avoid conflicts, as it defines the __gl_h_ include guard.

Code Reference

Source Location

Key Functions

// Version tracking structure
struct gladGLversionStruct {
    int major;
    int minor;
};
extern struct gladGLversionStruct mjGLVersion;

// Load all OpenGL function pointers (requires current GL context)
int mjGladLoadGL(void);

// Load GL function pointers without thread safety guarantees
int mjGladLoadGLUnsafe(void);

Import

#include "render/glad/glad.h"

I/O Contract

Inputs

Name Type Required Description
(none) - - Header-only; no runtime inputs

Outputs

Name Type Description
mjGLVersion struct gladGLversionStruct Global struct holding the loaded OpenGL major and minor version
Function pointer externs PFNGL*PROC Extern declarations for all OpenGL function pointers (e.g., mjGlad_glCullFace, mjGlad_glClear)
Extension flags int Extern flags such as mjGLAD_GL_VERSION_1_0 indicating which GL versions/extensions loaded

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment