I tried to get my opengl engine to use the z axis for the up axis, but no matter what I do, nothing is displayed. I compute a matrix like this:
float width = xymax - xmin;
float height = xymax - ymin;
float depth = zfar - znear;
float q = -(zfar + znear) / depth;
float qn = -2 * (zfar * znear) / depth;
float w = 2 * znear / width;
w = w / aspect;
float h = 2 * znear / height;
m[0] = w;
m[1] = 0;
m[2] = 0;
m[3] = 0;
m[4] = 0;
m[5] = 0;
m[6] = h;
m[7] = qn;
m[8] = 0;
m[9] = q;
m[10] = 0;
m[11] = 0;
m[12] = 0;
m[13] = 0;
m[14] = -1;
m[15] = 0;
earlier, when I had the Y axis as up (which worked fine), the code was something like this:
m[0] = w;
m[4] = 0;
m[8] = 0;
m[12] = 0;
m[1] = 0;
m[5] = h;
m[9] = 0;
m[13] = 0;
m[2] = 0;
m[6] = 0;
m[10] = q;
m[14] = -1;
m[3] = 0;
m[7] = 0;
m[11] = qn;
m[15] = 0;
Each object / vertex is first multiplied by a simple translation matrix:
1 0 0 xposition
0 1 0 yposition
0 0 1 zposition
0 0 0 1
and then the projection matrix created above I just get a black screen. Is there anything else I need to change for this?
zacaj source
share