mjs1

10-16-2004, 04:58 PM

I was trying to create the projection matrix myself rather than using gluPerspective() or glFrustum(). I used the matrix in the back of the red book defined for perspective projection. I'm having trouble coming up with the same values for the matrix I'm calculating that gluPerspective() comes up with. I was hoping someone could spot and see if I'm missing something.

For a camera with aspect ratio 1.33, a viewAngle of 30.0, and clipping planes at 0.1 and 300.0:

gluPersp matrix (from glGetDoublev()):

2.79904

0

0

0

0

3.73205

0

0

0

0

-1.0

-1.0

0

0

-0.2

0

my matrix:

2.79904

0

0

3.73205

0

0

0

0

-1.0

-0.2

0

0

-1.0

0

The 11 and 14 positions seem to be swapped. I'm confused by position 14, as all my references say to load -1.0 here. Why would gluPerspective's position 14 be anything other than -1.0?

Thanks for any help!

For a camera with aspect ratio 1.33, a viewAngle of 30.0, and clipping planes at 0.1 and 300.0:

gluPersp matrix (from glGetDoublev()):

2.79904

0

0

0

0

3.73205

0

0

0

0

-1.0

-1.0

0

0

-0.2

0

my matrix:

2.79904

0

0

3.73205

0

0

0

0

-1.0

-0.2

0

0

-1.0

0

The 11 and 14 positions seem to be swapped. I'm confused by position 14, as all my references say to load -1.0 here. Why would gluPerspective's position 14 be anything other than -1.0?

Thanks for any help!