Asked by At

So, I've been trying to find a solution to this error: 'toRadian' is not defined. I'm not using the minified version of glMatrix, and I am using version 3.0.0

Code: glMatrix.mat4.perspective(projectionMatrix, toRadian(45), canvas.width / canvas.height, .1, 1000.);

I've went through the source, and it is there. I'm not sure why this is happening but for right now, I've had to hardcode: 45 * Math.PI / 180, which I shouldn't really be doing because it just looks awful.

If someone could help me out, I'd really appreciate it. Thank you :)

2 Answers

PeaBrain On

I don't have much experience using glMatrix, but from what I can read in the documentation, toRadian is a proberty of glMatrix and not a global variable, so unless you somehow changed it's scope you'll have to write glMatrix.toRadian instead.

Another approach would be to add toRadian to the global scope:

window.toRadian = glMatrix.toRadian;

This should allow you to access the function just as you did in your example.

Vitex On

The answer is: glMatrix.glMatrix.toRadian(x);. Not sure why they'd change it without providing new documentation but here you go if you need it :)