Repository navigation
GLES: fix ofPolyline / ofBeginShape outlines not drawing (iOS, WebGL) and ignoring line width (Android) - #8585
Merged
danoli3 merged 2 commits intoOct 13, 2026
Conversation
On OpenGL ES, draw(ofPolyline) bound the positions as a client array and drew a raw GL_LINE_STRIP / GL_LINE_LOOP. With the lines shaders enabled (the default since openframeworks#8019) setAttributes() selects the lines shader, which expects the triangle mesh that draw(ofMesh) builds from the line, so the raw strip drew nothing on iOS and WebGL (open ofPolyline::draw and ofNoFill ofBeginShape / ofEndShape outlines were blank) and ignored ofSetLineWidth on Android. openframeworks#8533 also sent emscripten down this path, which is how WebGL broke. Use the client array path only when the lines shaders are disabled; otherwise use the same VBO mesh path as desktop GL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On OpenGL ES, open outlines don't draw:
ofPolyline::draw(), andofNoFill()+ofBeginShape()/ofEndShape(). The waveforms inaudioOutputExampleon WebGL are one visible case.draw(ofPolyline)had an ES-only path that binds the positions as a client array and draws a rawGL_LINE_STRIP/GL_LINE_LOOP. With the lines shaders enabled (the default since #8019),setAttributes()selects the lines shader. That shader expects the triangle meshdraw(ofMesh)builds from the line, with prev/next vertex attributes, so the raw strip:ofSetLineWidth.#8533 removed the
!TARGET_EMSCRIPTENexclusion from that path, which is when WebGL broke.Change
draw(ofPolyline)on ES uses the client-array path only when the lines shaders are disabled. Otherwise it uses the same VBO mesh path as desktop GL, which goes throughdraw(ofMesh)and its lines-shader bundle.Tested
The same test on each platform draws eight outline cases over black and counts the drawn pixels in each band:
ofBeginShape, width 1ofBeginShape, width 3ofDrawLine, width 1ofDrawLine, width 3ofPolyline::draw, width 1ofPolyline::draw, width 3ofBeginShapeofBeginShapeandofPolylineblank, closed shape skewedofBeginShape,ofPolylineand closed shape blankofDrawLineand the unfilled rectangle already worked on master and are unchanged.WebGL2: master / this PR

iOS simulator, ES 3.0: master / this PR

Android emulator, ES 3.0: master / this PR

Not tested on real devices.