Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

452
Views
Uncaught ReferenceError: mat4 is not defined even gl-Matrix library is downloaded

I am building a 2d graphics engine using webgl, JavaScript and HTML, I wanted the gl-Matrix.js graphics library to do transformations so, I downloaded the lg-Matrix library zip file from their website https://glmatrix.net and extracted it into a folder called lib in my project. I didn't forgot to add the .js file to the HTML file using a script tag

<script type="text/javascript" src="src/lib/toji-gl-matrix-0bca31a/dist/gl-matrix.js"></script>

Then I call some lg-Matrix functions as follows.

    var xform = mat4.create();
    mat4.translate(xform, xform, vec3.fromValues(-0.25, 0.25, 0.0));
    mat4.rotateZ(xform, xform, 0.2); 
    mat4.scale(xform, xform, vec3.fromValues(1.2, 1.2, 1.0));
    
    this.mWhiteSq.draw(xform);

this.mWhiteSq is a function that draws a white square to the middle of the canvas, It is also applies the given transformations.

The problem is JavaScript console in the browser prints the error massage mentioned in the title. It says that mat4 is not defined.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Hey I just discovered that the problem can be solved by using glMatrix.mat4.create() instead of just using mat4.create(). It's the same for every other function.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!