Skip to content

Many matrix operations are translated into illegal AGAL code #27

Georg123 opened this Issue Apr 24, 2013 · 0 comments

1 participant


void main()
mat4 m = mat4(1.0);
gl_Position = m * gl_Vertex;


mul op.xyzw, mat4(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0), va0.xyzw

attribute vec3 _normal;
attribute vec3 _binormal;
attribute vec3 _tangent;

void main()
mat3 m = mat3(_normal, _binormal, _tangent);
gl_Position = vec4(m * vec3(1, 0, 0), 1);


mov, va0.xyzz
mov, va1.xyzz
mov, va2.xyzz
mov vt0.w, vc0.xxxx
m33, vc0.xyzz, vt0
mov op.xyzw, vt0.xyzw

It keeps overwriting vt0. This also happens with a mat4.

void main()
mat4 modelViewTranspose = transpose(gl_ModelViewMatrix);
gl_Position = modelViewTranspose * vec4(0, 0, 0, 1);


mov vt0.x, vc0.xxxx
mov vt1.x, vc0.yyyy
mov vt2.x, vc0.zzzz
mov vt3.x, vc0.wwww
mov vt0.y, vc1.xxxx
mov vt1.y, vc1.yyyy
mov vt2.y, vc1.zzzz
mov vt3.y, vc1.wwww
mov vt0.z, vc2.xxxx
mov vt1.z, vc2.yyyy
mov vt2.z, vc2.zzzz
mov vt3.z, vc2.wwww
mov vt0.w, vc3.xxxx
mov vt1.w, vc3.yyyy
mov vt2.w, vc3.zzzz
mov vt3.w, vc3.wwww

mul op.xyzw, vt0, vc4.xyzw

The transpose seems to be correct, but it uses mul instead of m44.

uniform mat4 _modelMatrix;
uniform mat4 _viewMatrix;

void main()
mat4 modelView = _viewMatrix * _modelMatrix;
gl_Position = modelView * vec4(0, 0, 0, 1);


mov vt0.xyzw, vc0
mul vt4.xyzw, vt0, vc4
m44 op.xyzw, vc8.xyzw, vt4

This is not a matrix multiplication.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.