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

API: passing uniforms to shaders as a map #50

Closed
schiller-manuel opened this issue Dec 19, 2021 · 2 comments · Fixed by #59
Closed

API: passing uniforms to shaders as a map #50

schiller-manuel opened this issue Dec 19, 2021 · 2 comments · Fixed by #59

Comments

@schiller-manuel
Copy link
Contributor

Currently, uniforms are passed to shaders as an array:

<Shader source={source} uniforms={[blue, r]} />

How about passing them as a map, the same way its done in gl-react? (see e.g. https://gl-react-cookbook.surge.sh/colordisc)

<Shader source={source} uniforms={{blue, r}} />

Then order would not matter, but the object keys must match the uniform name in the shader.

@schiller-manuel
Copy link
Contributor Author

After checking canvaskit, this is probably a bad idea since we would then lose compatibility with canvaskit ...

@wcandillon
Copy link
Contributor

not necessarily, we might be able to get from map to array using getUniformInfo() and this might be a good API change :)

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 a pull request may close this issue.

3 participants