Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Damien TOURAINE <damien.touraine@li...>  20010412 13:35:12

Hi all ! I'm trouble about the use of homogenous coordinates in OpenGL, and more specifically, with the glFrustum function : It seems that the last coordinate (homogenous one) is replaced in the case of this function by the Zcoordinate. Is it true or am I wrong ? Moreover, when are the standards coordinates divided by the homogenous one ? If they are divided after the Projection matrix, how does MesaGL deal with this function (does it means that the homogenous coordinate is definitively loose) ? How OpenGL deal with the case of vertices on the Z=0 plan with the frustum matrix (thoses vertices would be at the infinite, but the computer don't understand "infinite") ? Friendly Damien TOURAINE   Damien TOURAINE  +33 1 69 85 81 68 PhD student at LIMSI  CNRS (http://www.limsi.fr) Bat. 508, Universite ParisSud F91403 Orsay cedex (France)  
From: Brian Paul <brianp@va...>  20010412 13:57:44

Damien TOURAINE wrote: > > Hi all ! > > I'm trouble about the use of homogenous coordinates in OpenGL, and more > specifically, with the glFrustum function : > It seems that the last coordinate (homogenous one) is replaced in the > case of this function by the Zcoordinate. Is it true or am I wrong ? If I understand you correctly, yes, that's basically true. > Moreover, when are the standards coordinates divided by the homogenous one ? After application of the projection matrix, but before viewport mapping. > If they are divided after the Projection matrix, how does MesaGL deal > with this function (does it means that the homogenous coordinate is > definitively loose) ? I don't understand. If (px,py,pz,pw) is the postprojection coordinate then the NDC, normalized device coordinates, (nx, ny, nz) are computed with: nx = px / pw ny = py / pw nz = pz / pw nx, ny and nz will be in [1,1] and are subsequently scaled and bias according to glViewport() and glDepthRange(). > How OpenGL deal with the case of vertices on the Z=0 plan with the > frustum matrix (thoses vertices would be at the infinite, but the > computer don't understand "infinite") ? The near clipping plane prevents coordinates with Z=0. Brian 
From: Damien TOURAINE <damien.touraine@li...>  20010412 14:18:16

Brian Paul wrote: > Damien TOURAINE wrote: > >> Hi all ! >> >> I'm trouble about the use of homogenous coordinates in OpenGL, and more >> specifically, with the glFrustum function : >> It seems that the last coordinate (homogenous one) is replaced in the >> case of this function by the Zcoordinate. Is it true or am I wrong ? > > If I understand you correctly, yes, that's basically true. >> Moreover, when are the standards coordinates divided by the homogenous one ? > > After application of the projection matrix, but before viewport mapping. > >> If they are divided after the Projection matrix, how does MesaGL deal >> with this function (does it means that the homogenous coordinate is >> definitively loose) ? > > I don't understand. If (px,py,pz,pw) is the postprojection coordinate > then the NDC, normalized device coordinates, (nx, ny, nz) are computed with: > > nx = px / pw > ny = py / pw > nz = pz / pw > > nx, ny and nz will be in [1,1] and are subsequently scaled and bias > according to glViewport() and glDepthRange(). Yes of course, but the problem is : Imagine that I post a vertex that homogenous coordinates are (3.0, 3.0, 3.0, 3.0) => NDC = (1.0, 1.0, 1.0) ... With the Identity in the modelview as well as in the projection matrix, ie, a glOrtho(1.0, 1.0, 1.0, 1.0, 1.0, 1.0) the finale NDC point provided to the viewport would be OK (1.0, 1.0, 1.0). However, in the case of Frustum matrix, as I loose the homogenous coordinates, I would have a defect in the drawing (homothetie) ... Is it true ? >> How OpenGL deal with the case of vertices on the Z=0 plan with the >> frustum matrix (thoses vertices would be at the infinite, but the >> computer don't understand "infinite") ? > > The near clipping plane prevents coordinates with Z=0. Yes, but all the vertices are computed by the two matrices and the clipping by the front plane are done after the NDC ... Thus, a problem may occur ! Friendly Damien TOURAINE   Damien TOURAINE  +33 1 69 85 81 68 Doctorant au LIMSI  CNRS (http://www.limsi.fr) Bat. 508, Universite ParisSud 91403 Orsay cedex  
From: Brian Paul <brianp@va...>  20010412 14:26:55

Damien TOURAINE wrote: > > Brian Paul wrote: > > > Damien TOURAINE wrote: > > > >> Hi all ! > >> > >> I'm trouble about the use of homogenous coordinates in OpenGL, and more > >> specifically, with the glFrustum function : > >> It seems that the last coordinate (homogenous one) is replaced in the > >> case of this function by the Zcoordinate. Is it true or am I wrong ? > > > > If I understand you correctly, yes, that's basically true. > > >> Moreover, when are the standards coordinates divided by the homogenous one ? > > > > After application of the projection matrix, but before viewport mapping. > > > >> If they are divided after the Projection matrix, how does MesaGL deal > >> with this function (does it means that the homogenous coordinate is > >> definitively loose) ? > > > > I don't understand. If (px,py,pz,pw) is the postprojection coordinate > > then the NDC, normalized device coordinates, (nx, ny, nz) are computed with: > > > > nx = px / pw > > ny = py / pw > > nz = pz / pw > > > > nx, ny and nz will be in [1,1] and are subsequently scaled and bias > > according to glViewport() and glDepthRange(). > > Yes of course, but the problem is : > Imagine that I post a vertex that homogenous coordinates are (3.0, 3.0, > 3.0, 3.0) => NDC = (1.0, 1.0, 1.0) ... > With the Identity in the modelview as well as in the projection matrix, > ie, a glOrtho(1.0, 1.0, 1.0, 1.0, 1.0, 1.0) the finale NDC point > provided to the viewport would be OK (1.0, 1.0, 1.0). > However, in the case of Frustum matrix, as I loose the homogenous > coordinates, I would have a defect in the drawing (homothetie) ... > Is it true ? I don't understand. Remember that clipping to the viewing frustum is performed after application of the project matrix, but before the dividebyW. Frustum clipping ensures that pw < px < pw, pw < py < pw and pw < pz < pw. > >> How OpenGL deal with the case of vertices on the Z=0 plan with the > >> frustum matrix (thoses vertices would be at the infinite, but the > >> computer don't understand "infinite") ? > > > > The near clipping plane prevents coordinates with Z=0. > > Yes, but all the vertices are computed by the two matrices and the > clipping by the front plane are done after the NDC ... > Thus, a problem may occur ! Clipping is performed on the project coordinates, before dividing by W and before NDCtoViewport mapping. Brian 