I am trying to port this GLSL Shaders to Stage3D and AGAL, but I cannot make it work:
Vertex Shader (GLSL)
attribute vec3 aVertexPosition;
attribute vec4 aVertexColor;
uniform mat4 uMVMatrix;
uniform mat4 uPMatrix;
varying vec4 vColor;
void main(void) {
gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
vColor = aVertexColor;
}
Fragment Shader (GLSL)
precision mediump float;
varying vec4 vColor;
void main(void) {
gl_FragColor = vColor;
}
Having as a result:
Vertex Shader (AGAL)
mov vt0.w, vc0.x
mov vt0.xyz, va0.xyz
mov vt1.xyzw, vc1
mul vt5.xyzw, vt1, vc5
m44 op.xyzw, vt0.xyzw, vt5
mov v0.xyzw, va1.xyzw
Fragment Shader (AGAL)
mov oc.xyzw, v0.xyzw
Here it is a trace of the instructions I execute:
(setVertexBufferAt) va0 3 0
(setVertexBufferAt) va1 4 3
(identity setProgramConstantsFromMatrix): vc0 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1
(setProgramConstantsFromMatrix) vc1 1,0,0,0,0,1,0,0,0,0,1,0,0,0,-2,1
(setProgramConstantsFromMatrix) vc5 1.8106601238250732,0,0,0,0,2.4142136573791504,0,0,0,0,-1.0020020008087158,-1,0,0,-0.20020020008087158,0
render drawTriangles + present
But I can't still see anything.
Update: Apparently the problem is that the triangle is being clipped. Values on the multiplicated array are bigger than 1.0 which makes them clipped out. So I need to find a way to normalize the matrix or yo extend the clipping
Any suggestion?