Re: Confusion with PMVMatrix
Posted by
elect on
Feb 25, 2016; 7:54am
URL: https://forum.jogamp.org/Confusion-with-PMVMatrix-tp4029336p4036340.html
Irene Tang wrote
Why is the projection matrix

after m.glMatrixMode(GL_PROJECTION);
m.glOrthof(0, 10, 0, 10, 1, -1); Why the value in the blue circle isn't -1?
public static Mat4 ortho(Mat4 res, float left, float right, float bottom, float top, float zNear, float zFar) {
res.m00 = 2.0f / (right - left);
res.m01 = 0.0f;
res.m02 = 0.0f;
res.m03 = 0.0f;
res.m10 = 0.0f;
res.m11 = 2.0f / (top - bottom);
res.m12 = 0.0f;
res.m13 = 0.0f;
res.m20 = 0.0f;
res.m21 = 0.0f;
res.m22 = -2.0f / (zFar - zNear);
res.m23 = 0.0f;
res.m30 = -(right + left) / (right - left);
res.m31 = -(top + bottom) / (top - bottom);
res.m32 = -(zFar + zNear) / (zFar - zNear);
res.m33 = 1.0f;
return res;
}
that value is m22
m22 = -2.0f / (-1 - 1) = -2.0f / -2 = 1
I strongly suggest you to move away from using deprecated opengl and starting working with the matrices directly by yourself ;)