glVertex4f

• 11-24-2003
frenchfry164
glVertex4f
I noticed that there is a glVertex4f. The fourth parameter is w. What is w used for?
• 11-26-2003
sic1
hmm, weight?
• 11-26-2003
the coordinate 'w' is used for quaternions.
• 11-26-2003
Quote:

the coordinate 'w' is used for quaternions.
the gl uses 4x4 matrices for transformation. a translation is stored in the 4th column of that matrix. A 1 is always at the 4th col, 4th row of the matrix. The GL is always using 4 vectors internally. The w coordinate is set to 1 by default. Changing w scales how translations effect that vertex. It has nothing to do with quaternions.
• 11-28-2003
frenchfry164
I don't get it. A translation is stored in the fourth column? What translation is stored there? I thought translations only effected the first three columns.
• 11-29-2003
Quote:

Originally posted by frenchfry164
I don't get it. A translation is stored in the fourth column? What translation is stored there? I thought translations only effected the first three columns.
Not possible.
The manual.
Linear algebra.
Dirt cheap linear algebra.
```glLoadIdentity( ); glTranslatef( a, b, c ); glVertex3f( x, y, z ); |1 0 0 a|  |x|  |x+a| |0 1 0 b|  |y|  |y+b| |0 0 1 c| * |z| = |z+c| |0 0 0 1|  |1|  |1|```
```glLoadIdentity( ); glTranslatef( a, b, c ); glVertex4f( x, y, z, 3 ); |1 0 0 a|  |x|  |x+3a| |0 1 0 b|  |y|  |y+3b| |0 0 1 c| * |z| = |z+3c| |0 0 0 1|  |3|  |3|```