My projection matrix was buggy, I'm not great at mathematics, but I checked it against the the songho tutorial, and the broken one seems correct to me but switching nearplane to farplane seems to have fixed it. What am I missing? My nearplane and farplane values are positive, nearplane is small about 0.01, 1.0f last time i ran against both; farplane is usually relatively large about 1000.0f, 500.0f the last time I ran it against both.
f32 l = left;
f32 r = right;
f32 t = top;
f32 b = bottom;
f32 n = nearplane;
f32 f = farplane;
m4x4 Result = //TODO why did changing n to f in 0 and 5 fix it? and make sure it is fixed
{
#if 0 // works
2*f/(r-l), 0, (r+l)/(r-l), 0,
0, 2*f/(t-b), (t+b)/(t-b), 0,
0, 0, -(f+n)/(f-n), -2*f*n/(f-n),
0, 0, -1, 0,
#else // doesn't
(2*n)/(r-l), 0, (r+l)/(r-l), 0,
0, (2*n)/(t-b), (t+b)/(t-b), 0,
0, 0, -(f+n)/(f-n), (-2*f*n)/(f-n),
0, 0, -1, 0,
};
#endif