Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!sgi!shinobu!odin!bruceh From: bruceh@sgi.com (Bruce R. Holloway) Newsgroups: comp.sys.sgi Subject: Re: question on gl Message-ID: <1991Apr3.202236.12601@odin.corp.sgi.com> Date: 3 Apr 91 20:22:36 GMT References: <14154@medusa.cs.purdue.edu> <1991Apr2.224901.8498@odin.corp.sgi.com> <14168@medusa.cs.purdue.edu> Sender: news@odin.corp.sgi.com (Net News) Distribution: usa Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 27 In article <14168@medusa.cs.purdue.edu> avr@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