openframeworks / openframeworks/openFrameworks
ofShader: vertex attribute arrays need to be disabled on end()
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.4k
- Forks
- 2.6k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 9
Description
I have recently experienced that using vertex attribute arrays from setAttribute3fv results in strange behavior on the Nvidia driver, but not on Intel. When the vertex attribute pointer was set - it caused strange yellowish drawing of all other content following the call.
After a lot of digging I found that the vertex attribute pointer need to be disabled after using the shader - otherwise it will affect subsequent drawing. Basically the glEnableVertexAttribArray need to be complemented with a call to glDisableVertexAttribArray.
Solutions:
-
As a minimum we could add a function called
ofShader::disableAttributePointer. -
Or, more advanced,
setAttribute3fvshould update a map with attributePointers that should be disabled onend();
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing ofShader::setAttribute3fv and ofShader::end(), focusing on where glEnableVertexAttribArray is called. Verify how enabled vertex attribute arrays affect subsequent drawing, then determine whether the affected attributes can be disabled during end() or through a separate disableAttributePointer entry point. Done means later drawing is no longer affected after using the shader.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100