Open
Description
On the page https://github.com/greggman/webgl2-fundamentals/blob/master/webgl/lessons/webgl-2d-matrices.md the rotation matrix generator is incorrectly defined as:
rotation: function(angleInRadians) {
var c = Math.cos(angleInRadians);
var s = Math.sin(angleInRadians);
return [
c,-s, 0,
s, c, 0,
0, 0, 1,
];
},
This results in rotation in the reverse direction. Matrix components in GLSL are defined in column-major order, so the correct definition should be:
rotation: function(angleInRadians) {
var c = Math.cos(angleInRadians);
var s = Math.sin(angleInRadians);
return [
c, s, 0,
-s, c, 0,
0, 0, 1,
];
},
Metadata
Metadata
Assignees
Labels
No labels