How do I include gl-matrix?

Once the source is specified correctly, I still couldn't directly call mat4.

I had to type "glMatrix.mat4" instead.


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>

Just include /dist/gl-matrix-min.js or /dist/gl-matrix.js :)


  1. Download from here
  2. Extract and take gl-matrix-min.js
  3. In your index.html file <script src="gl-matrix-min.js"></script>
  4. Now try var mvMatrix = glMatrix.mat4.create();