Hey, FYI, you can use the …[/code[b][/b]] tags to post code. Anyway,
try looking at
[url=http://www.opengl.org/sdk/docs/man/xhtml/glFrustum.xml]this[/url]
which shows how the projection matrix is set up in OpenGL (they use the
column matrix convention, so it’ll be transposed with respect to yours,
and there may be some sign differences as well). From a quick look I see
that your m33 appears to be missing a term and your m43 is missing a
factor of 2. Also, the projection routine looks odd to me - in the
‘newpoint’ line, why are you taking each component and multiplying by w,
then dividing by z? You should just need to divide by w. Note that the
projection matrix moves z into w (that’s what the m34 = 1 does).
[code]…[/code****] tags to post code.

Anyway, try looking at this which shows how the projection matrix is set up in OpenGL (they use the column matrix convention, so it’ll be transposed with respect to yours, and there may be some sign differences as well).

From a quick look I see that your m33 appears to be missing a term and your m43 is missing a factor of 2.

Also, the projection routine looks odd to me - in the ‘newpoint’ line, why are you taking each component and multiplying by w, then dividing by z? You should just need to divide by w. Note that the projection matrix moves z into w (that’s what the m34 = 1 does).

Hi, i am trying to make a projection matrix for a software renderer im doing and i think ive nearly got it sorted but its not quite coming out right the code for setting the matrix is:

i set the FOV both FOV to pi/4 the near to 1 and the farplane to 1000

Then for each point in the triangle i transform it with the matrix

The problem is the perspective dosn’t look right it changes with a differant z value but its not really in perspective and there is not much defferance betweem 60 z and 600 z.

Has anyone got any ideas where im going wrong?

Thanks