Original Post
Hi all again, back to doing 3D manually... My original post here if you need to read that. I wrote a small program to draw a grid, (-25 to 25, -25 to 25, -2) with camera at (0,0,0), no rotation. I draw this grid, but it only outputs one little dot in the center of the screen, and i'm 99% sure it has something to do with my projection matrix. According to Drillan, from the previous post, projection matrix should look like One thing that might be going wrong is i'm using radians instead of dregrees? (although when i looked in the DX SDK it seemed like it was using radians, but i'm not sure) Any help would be nice Thanks all again ~zix~
w 0 0 0
0 h 0 0
0 0 zf/(zf-zn) 1
0 0 -zn*zf/(zf-zn) 0
where:
h is the view space height. It is calculated from h = cot(fovY/2);
w is the view space width. It is calculated from w = h * aspect (where aspect = screenWidth/screenHeight)
zf = farthest visible distance, zn = nearest visible distance
void TGBUFFER::wProjection(float fovy, float aspect, float zn, float zf){
mProj=MatrixIdentity();
mProj.m22=(1.0 / tan(fovy/2.0));
mProj.m11=mProj.m22 * aspect;
mProj.m33=zFar/(zFar-zNear);
mProj.m43=-zNear*zFar/(zNear-zFar);
mProj.m34=1;
mProj.m44=0;
}