What I did:
Downloaded master branch from here: https://github.com/toji/gl-matrix Put src folder into my project's folder. Included gl-matrix-manifest.js from there. Tried this:
var mvMatrix = mat4.create();
Result:
var mvMatrix = mat4.create();
ReferenceError: mat4 is not defined
Okay, let's indlude mat4 directly. Included. Result:
var out = new GLMAT_ARRAY_TYPE(16);
ReferenceError: GLMAT_ARRAY_TYPE is not defined
Okay, maybe it needs common.js:
var x = axis[0], y = axis[1], z = axis[2],
TypeError: axis is undefined
WTF, included all other files from src folder (common, vectors,matrices,quat):
var x = axis[0], y = axis[1], z = axis[2],
TypeError: axis is undefined
(same)
How do I include propertly? In particular I need mat4 and vec4.
Once the source is specified correctly, I still couldn't directly call mat4.
I had to type "glMatrix.mat4" instead.
<script src="gl-matrix-min.js"></script>
var mvMatrix = glMatrix.mat4.create();
Just include /dist/gl-matrix-min.js or /dist/gl-matrix.js :)
Add this cdn link in head
<script src="https://cdnjs.cloudflare.com/ajax/libs/gl-matrix/2.8.1/gl-matrix-min.js"
integrity="sha512-zhHQR0/H5SEBL3Wn6yYSaTTZej12z0hVZKOv3TwCUXT1z5qeqGcXJLLrbERYRScEDDpYIJhPC1fk31gqR783iQ=="
crossorigin="anonymous" defer>
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With