Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

446
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda