Repository navigation
OpenGLES 3.1 - #8533
OpenGLES 3.1#8533danoli3 wants to merge 51 commits into
Conversation
|
Smoke tests on GL failing will investigate |
8d27b58 to
b15ce0c
Compare
ebd5b9c to
7ea5268
Compare
|
This is almost complete just to do physical device tests |
ae83f44 to
bae1ec5
Compare
Rebased on master + GLES fixes + GL / GLES test matrixRebased onto current New commit
Test matrixTest app = Checks: context (renderer set up at the requested version) · texture upload → draw into FBO → readback colour · shader compile/link/draw → readback (programmable only) · smoke (indexed
macOS tops out at GL 4.1 (any 3.2+ core request returns 4.1); GL 4.2+ needs Linux/Windows. Android emulator (ES 1.1 / 2.0 / 3.0 / 3.1) and emscripten (WebGL 1 / 2) runs to follow. Also found: with older downloaded libs, ScreenshotsmacOS — GL 2.1 (fixed function) |
|
This is looking great! Getting Qwen 3.8 local ai to test and analyse everything and doing test qa passes |
Emscripten results (WebGL 1 / WebGL 2)Same test app (graphicsExample scene + Run in headless Chrome on the real GPU (
Note: Running total: macOS GL 2.1 / 3.2 / 3.3 / 4.0 / 4.1, iOS Simulator ES 1.1 / 2.0 / 3.0, emscripten WebGL 1 / 2 — all PASS. Android emulator (ES 1.1 / 2.0 / 3.0 / 3.1) next. Screenshots |
# Conflicts: # libs/openFrameworks/gl/ofGLProgrammableRenderer.cpp
The shared test always called drawInstanced, which is not in ES1/ES2 or GL 2.1, and the programmable GLES path never instanced even on ES3 (gated on 3.1, and ofVboMesh ignored primCount). Skip instancing unless the live context is GL 3.1+ / ES 3.0+, match VBO index type to ofIndexType on GLES, report WebGL2 as GLES 3, and give the Android lifecycle test ES2 shaders / an ES1 no-shader path.
- ofGraphics/ofGLRenderer: revert background-gradient relocation that used ofVboMesh without its header and dropped the renderer's drawBackgroundGradient definition (broke every build + link) - ofGraphics: revert illegal static_cast to ofBaseGLRenderer in ofEnable/DisablePointSprites, virtual dispatch already covers it - ofAppEGLWindow: rename glesVersion member to glesVersionMajor to match ofAppEGLWindow.cpp usage - ofAppAndroidWindow: drop dead overwrite of glesVersion from legacy field so settings getters take effect, init glesVersionMinor - ofxEmscriptenURLFileLoader: restore lowercase __EMSCRIPTEN_major__/ __EMSCRIPTEN_minor__ macros (uppercase form is never defined) - ofTexture: restore GL_TEXTURE_CUBE_MAP mipmap case on desktop, align bindAsImage cpp guard with header - ofConstants: make GLES3 includes live (unconditional on Linux ARM and Emscripten, API-gated on Android) so TARGET_OPENGLES_3 auto-detection actually works
- ofFbo::readToPixels: GLES has no glGetTexImage (ES 1/2/3), so the ES 3 branch returned empty pixels; read the bound FBO with glReadPixels on all GLES again, selecting the attachment with glReadBuffer on ES 3 contexts. - ofGLProgrammableRenderer::draw(ofMesh) on ES: line modes use the lines shader, which needs the line bundle; raw client arrays made GL_LINE_STRIP / GL_LINE_LOOP (circle and polyline outlines) collapse to nothing. Build the bundle like desktop (ofSetLineWidth works on ES again). - ofFbo::allocate(w, h, format): keep colour-only on ES; the combined depth+stencil renderbuffer was FRAMEBUFFER_INCOMPLETE_ATTACHMENT. - TARGET_OPENGLES_3 only means the ES 3 headers exist, which is true on iOS even for ES 1 / ES 2 contexts. Add ofIsGLES3Context() (headers + live context >= 3) and use it for sized RGBA8 / RGB8 internal formats (ES 2 rejects them with GL_INVALID_OPERATION); ofFbo::checkGLSupport accepts GL_OES_framebuffer_object for ES 1.1 contexts.
On Android an ES 1 context has no GLES2 entry points, so glGenFramebuffers resolved to a null function pointer and ofFbo::allocate crashed (SIGSEGV, pc 0) on ES 1.1 contexts. iOS shares one GL library across ES versions, so the OES path stays enabled there; Android ES 1.1 now reports FBOs as unsupported instead of crashing.
Found with a glGetError trace after every setup/draw step on the Android emulator (ES 1.1) and iOS Simulator (ES 1.1 / 2.0): - ofGLRenderer: loadViewMatrix / enableLighting / setLightPosition / setLightSpotDirection queried glGetIntegerv(GL_MATRIX_MODE), which some ES 1.1 drivers reject, then restored glMatrixMode() from the uninitialised result (two errors per setupScreen, every frame). Restore the matrix mode oF already tracks in matrixStack instead. - ofTexture::loadData: on ES 1.1 (fixed function) the Android emulator rejects glTexSubImage2D with GL_LUMINANCE / GL_LUMINANCE_ALPHA / GL_ALPHA and leaves the texture empty, so ofDrawBitmapString drew nothing. Full-size updates re-specify the level with glTexImage2D. - ofFbo::checkGLSupport: GL_MAX_COLOR_ATTACHMENTS / GL_MAX_DRAW_BUFFERS / GL_MAX_SAMPLES are ES 3 queries; on ES 1 / ES 2 contexts built with ES 3 headers (iOS) use 1 / 1 / 0 instead of querying. Now zero GL errors on macOS GL 2.1 / 3.2, iOS ES 1.1 / 2.0 / 3.0 and Android ES 1.1 / 2.0 / 3.0 / 3.1.
Stacked on #8575 + full retest (all platforms)Rebased onto #8575 (Android: NDK r29 / min API 25 / build-tools 37, synced with apothecary) — no conflicts. This branch is now #8575's commit + this PR's 49 commits (head Everything rebuilt clean from this exact branch and re-run with the same GL test app (graphicsExample scene +
* the emulator only provides an ES 3.0 context. Android uses the tess2 Screenshots |
On Android an ES 1.1 context provides FBOs through GL_OES_framebuffer_object in libGLESv1_CM (glGenFramebuffersOES, ...); the core names resolve to libGLESv2 and are null in an ES 1 context. Add ofGLFramebuffer.h with ofGLGenFramebuffers / ofGLBindFramebuffer / ... wrappers that call the OES entry points on Android fixed-function contexts and the core names everywhere else (enum values are identical), and use them in ofFbo, ofGLRenderer and ofTexture (generateMipmap). The Android emulator's ES 1 driver (goldfish GLESv1_enc) advertises the extension but can't be used: glDeleteFramebuffersOES crashes (GLClientState::removeFramebuffers locks renderbuffer state that is only set up for ES 2+) and rebinding framebuffer 0 doesn't return drawing to the window. ofIsAndroidEmulatorGLES1() detects it from GL_RENDERER; ofGLRenderer::setup() logs a startup warning that FBOs won't work on the emulator with ES 1.1 but will on devices, and ofFbo reports them as unsupported there.
Android ES 1.1 FBOs via
|
























Overview
Adds OpenGL ES 3.0 and 3.1 support to openFrameworks, extending the existing rendering pipeline while maintaining compatibility with OpenGL ES 2.0 and desktop OpenGL.
This work builds upon #8512 by @mruegenberg, integrating the original GLES 3.x implementation with additional renderer fixes, platform improvements, and compatibility updates.
The goal is to modernise openFrameworks’ OpenGL ES support and improve portability across Android, iOS, Emscripten/WebGL, and other GLES-based environments.
Key Changes
OpenGL ES 3.0 / 3.1 Support
Rendering Improvements
Platform Support
Tessellation
Testing and Stability
Why This Matters
OpenGL ES 3.x introduces capabilities beyond GLES 2.0, including improved buffer handling, texture formats, and additional GPU functionality.
Supporting these versions allows openFrameworks to take better advantage of modern mobile GPUs and improves compatibility with graphics translation layers and backends such as ANGLE, Dawn, Metal, and Vulkan.
This also establishes a stronger foundation for future rendering improvements without requiring separate rendering implementations for each platform.
Compatibility
The intention is to preserve existing behaviour for projects using GLES 2.0 or desktop OpenGL.
GLES 3.x functionality is enabled through the appropriate rendering configuration and platform support.
Remaining Validation
Credits
Based on the original OpenGL ES 3.0 / 3.1 work by @mruegenberg in #8512, with additional integration, fixes, and platform compatibility improvements.
@danoli3 for updating ancient PR by hand
Qwen 3.8 for code updating and analysis
Claude for PR / Rebasing / Test cases and running simulators