question on gl

Bruce R. Holloway bruceh at sgi.com
Thu Apr 4 06:22:36 AEST 1991


In article <14168 at medusa.cs.purdue.edu> avr at cs.purdue.edu (Andrew V. Royappa) writes:
>
>OK, I've read the articles by Bruce Holloway & Gary Tarolli...
>
>Here's what I`m doing, for *perspective* projection:
>
>(1) extend from 3D to 4D coordinates; multiply by MVP matrices given at
>back of gl user's guide. 
>
>(2) divide 4D result by w to return to 3D
>
>(3) clip resulting geometry against -1.0<=x,y,z<=1.0

Well, both Gary & I said to clip before doing the perspective division.

>Since bruceh says that the gl matrices guarantee w > 0, I don't see
>any problem regarding correctness with the division in step (2). The
>only modelling  matrices (the "M" of the "MVP" above) that I use are
>translate, scale and rotate. What could I still be doing wrong ?

I guess what I said about w > 0 was unclear.  If the near plane is in front
of the eye (which our perspective() & window() routines force you to do)
and if you extend from 3D to 4D by introducing some w > 0, then after
clipping against the near plane it is guaranteed that the transformed w > 0.
You should clip so that -w <= x,y,z <= +w before dividing.

Regards, bruceh



More information about the Comp.sys.sgi mailing list