View Full Version : w coordinate
12-03-2005, 07:37 AM
what is the sense of this forth component of a vertex. still don't understand it....
When you stipple a w value that's different of 1.0, this means you're not under an homeogenous coordinate system. When you don't stipple it or if you put it at 1.0, you're under homogeneous coordinates. But OpenGL defauts to non-homogeneous coordinates system and homogeneous coordinates are just a special case of that whole, meaning:
glVertex4f (x,y,z,w) will be interpreted by GL as x/w, y/w, z/w simply and glVertex3f (x,y,z) will be interpreted as x/1,y/1,z/1.
Hope that helps.
12-03-2005, 11:35 AM
is the division done after the vertex shader (for example lighting)?
GL uses the 4 values for all the stuff, I'm pretty sure about it, so I guess it keeps it all along the work. I can hope this has something to do with memory alignment.
Well I must admit I've made an error: (x,y,z,w) are homogeneous coordinates, but (x,y,z) are just what called euclidian coordinates | thousands sorries for that :D I'm so not used to use 4 values, instead I - always - use 3 values.
Euclidian spaces are generally flat spaces whereas non-eclidian can be curve-spaces.
sorry again for the mistake.
12-03-2005, 01:52 PM
no problem. understood it now.
12-04-2005, 08:36 PM
Homogeneous coordinates are required for projective space. Think about a landscape painting; an object gets smaller if it moves further from eyepoint, or two parallel lines can meet each other at horizon.
These phenomena simply cannot be explained with Cartesian coords.
More explanation is here: Homogeneous Coordinates (http://www.songho.ca/math/homogeneous/homogeneous.html)
Yes, the perspective division by w occurs after lighting calculation and clipping by viewing volume clipping planes.
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.