Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for VAOs that use constant attributes #4995

Merged
merged 3 commits into from
Feb 13, 2017
Merged

Fix for VAOs that use constant attributes #4995

merged 3 commits into from
Feb 13, 2017

Conversation

lilleyse
Copy link
Contributor

Constant attributes set with glVertexAttrib4fv (and others) are incorrectly treated as part part of VAO state, while they are actually part of the context's state. These attributes need to bound manually when VertexArray is bound.

Source: https://www.khronos.org/opengl/wiki/Vertex_Specification#Non-array_attribute_values
Discovered through this bug on the forum: https://groups.google.com/forum/#!topic/cesium-dev/F6pMiEdXTcQ

Code example: http://localhost:8080/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=131e3e42d1710f49d0199d9dc8bd3328

Before / after:

bad

good

@@ -308,6 +309,10 @@ define([
hasInstancedAttributes = true;
break;
}
if (defined(vaAttributes[i].value)) {
hasConstantAttributes = true;
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this break statement and the one above should be here?

Either split this into a separate for loop or merge into the above and remove all the breaks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes.. fixed.

@pjcozzi
Copy link
Contributor

pjcozzi commented Feb 13, 2017

Worth an update to CHANGES.md?

@lilleyse
Copy link
Contributor Author

Updated.

@pjcozzi pjcozzi merged commit b4b4318 into master Feb 13, 2017
@pjcozzi pjcozzi deleted the vao-constant-fix branch February 13, 2017 14:35
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.

2 participants