Which OpenGL Versions Does JSAR Support on Different Operating Systems?

JSAR supports OpenGL 3.0+ on macOS and OpenGL ES 3.0+ on Android, while Windows and other platforms currently lack OpenGL backend support.

The JSAR runtime (m-creativelab/jsar-runtime) delegates all GPU rendering to Skia, which imposes specific OpenGL version requirements depending on the target operating system. Understanding these version constraints is essential for developers building cross-platform AR applications with JSAR.

OpenGL Version Support by Operating System

JSAR's rendering backends vary significantly across platforms, with support levels determined by Skia's internal capabilities and platform-specific graphics APIs.

macOS: OpenGL 3.0+ Desktop

On macOS, JSAR utilizes Skia's desktop OpenGL backend through the GrGLInterface class. The GrGLCaps class in thirdparty/headers/skia/src/gpu/ganesh/gl/GrGLCaps.h explicitly requires OpenGL 3.0 or newer, as indicated by the source comment * OpenGL 3.0+, OpenGL ES 3.0+, GL_ARB_framebuffer_object.

While the core rendering pipeline functions on macOS, the implementation is marked as partially supported because Apple has deprecated OpenGL in favor of Metal. Advanced features such as compute shaders and certain extensions are not yet implemented in the JSAR OpenGL backend for macOS.

Android: OpenGL ES 3.0+

Android devices running JSAR must support OpenGL ES 3.0 or higher. The runtime selects the OpenGLES3 backend during the Android build process (make android), which compiles Skia against OpenGL ES 3 headers.

The same GrGLCaps requirements apply here: the backend queries the EGL context at runtime to ensure the device reports at least version 3.0 before initializing the rendering pipeline. This guarantees access to essential features like framebuffer objects, vertex array objects, and GLSL ES 3.0 shaders.

Windows and Other Platforms: No OpenGL Support

Windows does not currently ship with an OpenGL backend in JSAR. Instead, the Windows build contains a Direct3D 11 stub that remains a work-in-progress. The thirdparty/headers/GLFW/glfw3.h file notes that OpenGL 3.0/3.1 contexts face compatibility issues on some platforms, reinforcing the decision to exclude OpenGL support on Windows for now.

Other platforms not explicitly listed (Linux desktop, iOS, etc.) also lack OpenGL backend support in the current JSAR runtime.

Why JSAR Requires OpenGL 3.0 and OpenGL ES 3.0

The version floor is determined by Skia's graphics capabilities class. In thirdparty/headers/skia/src/gpu/ganesh/gl/GrGLCaps.h, the minimum version requirements are hardcoded to ensure support for:

  • Framebuffer Objects (required for offscreen rendering and texture operations)
  • Vertex Array Objects (VAOs for efficient geometry management)
  • GLSL 1.30+ (desktop) or GLSL ES 3.0 (mobile) for shader compatibility

Attempting to run JSAR on hardware supporting only OpenGL 2.0 or OpenGL ES 2.0 will result in initialization failures when GrGLCaps queries the context capabilities.

How to Check Your OpenGL Version at Runtime

JSAR exposes the underlying GL context through the jsar.glContext property when the OpenGL or OpenGL ES backend is active. Use the following TypeScript snippet to verify which version your application is using:

// Query the GL version after renderer initialization
const gl = (self as any).jsar?.glContext as WebGLRenderingContext | WebGL2RenderingContext;

if (gl) {
  const version = gl.getParameter(gl.VERSION);
  console.log('JSAR is using', version);
  
  // Example macOS output: "OpenGL 3.3 GLX ..."
  // Example Android output: "OpenGL ES 3.0 V@84.0 (GIT@)"
} else {
  console.warn('No GL context available - check if OpenGL backend is active');
}

This runtime check is particularly useful when debugging cross-platform rendering issues or verifying that Android devices meet the OpenGL ES 3.0 minimum requirement.

Summary

  • macOS: Supports OpenGL 3.0+ (desktop) through Skia's GrGLInterface, marked as partially supported due to Apple's OpenGL deprecation.
  • Android: Requires OpenGL ES 3.0+ via the OpenGLES3 backend; fully supported.
  • Windows: No OpenGL backend available; uses an incomplete Direct3D 11 stub instead.
  • Version enforcement: Skia's GrGLCaps class in thirdparty/headers/skia/src/gpu/ganesh/gl/GrGLCaps.h mandates OpenGL 3.0+/ES 3.0+ for framebuffer and shader compatibility.

Frequently Asked Questions

Does JSAR support OpenGL 2.0 or older versions?

No. JSAR requires OpenGL 3.0 or higher on desktop platforms and OpenGL ES 3.0 or higher on Android. The Skia graphics engine explicitly checks for these versions in GrGLCaps and will fail to initialize on older hardware supporting only OpenGL 2.0 or OpenGL ES 2.0.

Can I use JSAR on Windows with OpenGL instead of Direct3D?

Currently, no OpenGL backend exists for Windows. The Windows build only contains a stub for Direct3D 11 rendering that remains under development. If you require OpenGL rendering on Windows, you would need to modify the build configuration to include Skia's OpenGL backend and handle context creation via GLFW or similar, which is not officially supported in the current JSAR runtime.

Why is macOS OpenGL support marked as partial?

Apple deprecated OpenGL in macOS in favor of Metal, and JSAR's OpenGL implementation on macOS does not yet implement newer graphics features such as compute shaders or advanced OpenGL extensions. While core rendering functionality works for OpenGL 3.0+ contexts, the "partially supported" status indicates that some modern GPU features available in the Android OpenGL ES 3.0 backend may be missing or limited on macOS.

How does JSAR handle OpenGL context creation?

JSAR delegates context creation to GLFW on desktop platforms and EGL on Android. On macOS, the runtime creates a GrGLInterface that wraps the native OpenGL driver, while on Android it initializes an OpenGLES3 backend through EGL context creation. The jsar.glContext property exposes this underlying context to JavaScript/TypeScript code, allowing runtime version queries using standard WebGL APIs.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →