# Re: view frustum corners with infinite projection matrix

*From*: wpoons@xxxxxxxxx*Date*: 15 Sep 2005 23:39:14 -0700

> What does your matrix look like? Can you post an example? What results do you get,

> and why do you they they are wrong?

Ok, i have now found an error in my projection matrix. i interchanged

two components. my projection matrix now:

| 2*zNear/(2*x) 0 0 0 |

| 0 2*zNear/(2*y) 0 0 |

| 0 0 -1 -2*zNear |

| 0 0 -1 0 |

I obtain this matrix from the standard opengl projection matrix with

lim zFar -> infinite

the sourcecode for setting up the matrix:

pInf[0][1] =

pInf[0][2] =

pInf[0][3] =

pInf[1][0] =

pInf[1][2] =

pInf[1][3] =

pInf[2][0] =

pInf[2][1] =

pInf[3][0] =

pInf[3][1] =

pInf[3][3] = 0;

pInf[2][3] = -1;

pInf[0][0] = (2*zNear)/(x-(-x));

pInf[1][1] = (2*zNear)/(y-(-y));

pInf[2][2] = -1;

pInf[3][2] = -2*zNear;

glMatrixMode(GL_PROJECTION);

// set infinite projection matrix

glLoadMatrixf(&pInf[0][0]);

this yields a more reasonable result as my wrong matrix before

(interchanged pInf[2][3] and pInf[2][3] so that pInf[2][3] was -2*zNear

and pInf[3][2] was -1. the old matrix brought me z-values of 199 for

the near plane and 201 for the far plane, which was not reasonable).

i now get for zNear = 1.0f

zValues of 199 for the near plane and

33554632 for the far plane which looks much better.

but why is the zValue for the near plane corners 199? should not that

be 1, because the near plane is at 1.0f?

thanks!

.

**Follow-Ups**:

**References**:**view frustum corners with infinite projection matrix***From:*wpoons

**Re: view frustum corners with infinite projection matrix***From:*Andy V

- Prev by Date:
**Re: stupid question of the day: backface surface normals** - Next by Date:
**Re: view frustum corners with infinite projection matrix** - Previous by thread:
**Re: view frustum corners with infinite projection matrix** - Next by thread:
**Re: view frustum corners with infinite projection matrix** - Index(es):