google / node-gles

Apache License 2.0
323 stars 31 forks source link

Uniform call fixes #56

Closed rnconrad closed 5 years ago

rnconrad commented 5 years ago

The main issue is that the value being passed to the count parameter for glUniform*v calls is the (byte) length of the ArrayLikeBuffer instead of the number of uniform variables (vectors/matrices). This can cause crashes when calling those functions.

Doc references: https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glUniform.xhtml https://www.khronos.org/opengl/wiki/GLSL_:_common_mistakes#How_to_use_glUniform

In order to determine the number of elements in an ALB, size() was added. Right now it just uses a switch statement to match the destructor.


This change is Reviewable

nkreeger commented 5 years ago

This is great - thank you!

Can you please run either:

yarn format

or

npm run format

Looks fine after that.

nkreeger commented 5 years ago

Just published 0.0.15 with this change - PTAL.