Skip to content

tex.setPixels binds to unit zero #11

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

Open
mattdesl opened this issue Jan 17, 2016 · 1 comment
Open

tex.setPixels binds to unit zero #11

mattdesl opened this issue Jan 17, 2016 · 1 comment

Comments

@mattdesl
Copy link
Member

This seems to be causing issues with gl-audio-analyser
stackgl/gl-audio-analyser#1

Because the bind() calls in setPixels is not necessarily going to be the same active unit as the user requests with tex.bind(n), it seems like it is causing some issues. I didn't realize this but according to the spec, the two seem tied somehow:

glTexImage2D specifies a two-dimensional or cube-map texture for the current texture unit, specified with glActiveTexture.

@hughsk
Copy link
Member

hughsk commented Jan 18, 2016

I wonder if we should keep track of the most recently bound texture unit for that instance, and bind to that? So:

tex1.setPixels(...) // binds to 0

tex1.bind(3)
tex2.bind(5)
tex1.setPixels(...) // binds to 3

A little less likely to cause issues, but it might still result in weirdness if you're working at the WebGL level. Either way would be worth one of us documenting this behaviour in the readme's setPixels() docs when/if we next have a chance :)

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

No branches or pull requests

2 participants