Skip to content

Set the number of enabled vertex attributes upon a shader program switch #16

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

Merged
merged 1 commit into from
Sep 7, 2016
Merged

Set the number of enabled vertex attributes upon a shader program switch #16

merged 1 commit into from
Sep 7, 2016

Conversation

monfera
Copy link
Contributor

@monfera monfera commented Sep 7, 2016

We ran into issues resulting in "glDrawArrays: attempt to render with no buffer attached to enabled attribute 1" and nothing rendered from that point on. Deriving from the standard, the way of avoiding the error seems to be either of:

  1. managing which vertex attrib arrays are enabled and disabled
  2. keeping vertex attrib arrays enabled but binding a mock or legacy buffer to it

The latter solution feels less robust in that it requires bindings to be left around 'just in case' a next shader program has fewer attributes and might benefit from the leftover binding.

This concept is the former solution. It works out fine with the plotly codebase on initial tests. There are two slight drawbacks: binding information to the gl object is safe but not pretty; use of introspection in render time. The latter problem is easily solved by flipping the comment line in the var newAttribCount lines.

I'd like to get feedback as this issue might have already come up and the resolution might have fallen some different way. As far as I know this approach is fairly common in tools that shuffle shaders in and out.

@etpinard etpinard mentioned this pull request Sep 7, 2016
4 tasks
@mikolalysenko
Copy link
Member

Thanks!

@mikolalysenko mikolalysenko merged commit 61e771e into stackgl:master Sep 7, 2016
@etpinard
Copy link

etpinard commented Sep 7, 2016

@mikolalysenko would you mind publishing a new npm release with this patch?

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.

3 participants