Skip to content

Improve OpenGL ES and modern OpenGL compatibility#1760

Merged
midwan merged 2 commits intomasterfrom
update-opengl
Jan 19, 2026
Merged

Improve OpenGL ES and modern OpenGL compatibility#1760
midwan merged 2 commits intomasterfrom
update-opengl

Conversation

@midwan
Copy link
Collaborator

@midwan midwan commented Jan 19, 2026

Fixes # .

Changes proposed in this pull request:

  • Improved OpenGL ES context initialization, including manual loading of VAO functions for better support on platforms like Raspberry Pi.
  • Enhanced OpenGL backend to support modern OpenGL (Core Profile 3.3+ and GLES 3.0+) with a fallback to legacy OpenGL 2.1.
  • Updated rendering pipeline to utilize Vertex Array Objects (VAOs) across shaders and crtemu.
  • Dynamically adjusted shader compatibility to match the active OpenGL context, ensuring proper versioning and keyword definitions.

@midwan

This update improves the OpenGL backend to support Modern OpenGL (Core Profile 3.3+ and GLES 3.0+), while retaining a fallback to Legacy OpenGL 2.1.

Changes include:
- **Context Creation**: `doInit` now attempts to create a modern context first. If that fails, it retries with a legacy compatibility context.
- **Shader Compatibility**: Shaders (OSD, External, and CRT) are now dynamically patched with the correct `#version` preamble and keyword definitions (`attribute` vs `in`, `varying` vs `out`) to match the active context.
- **VAO Support**: Implemented Vertex Array Objects (VAOs) usage across the rendering pipeline (OSD, External Shaders, crtemu), which is mandatory for Core Profile contexts.
- **crtemu updates**: Updated `crtemu.h` to handle VAOs and dynamic shader compilation. Fixed a uniform name mismatch in the blur shader.

This ensures better compatibility with drivers that deprecate legacy features or default to Core profiles.
- Allow OpenGL ES contexts to initialize instead of aborting.
- Manually load VAO functions (glGenVertexArrays, glBindVertexArray, glDeleteVertexArrays) if GLEW fails to load them, including OES variants. This improves compatibility on platforms like Raspberry Pi 4/5.
- Log available video drivers if SDL_Init fails to assist with debugging.
@midwan midwan merged commit 7956a0c into master Jan 19, 2026
53 checks passed
@midwan midwan deleted the update-opengl branch January 19, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant