1. ## glVertex4f

I noticed that there is a glVertex4f. The fourth parameter is w. What is w used for?

2. hmm, weight?

3. the coordinate 'w' is used for quaternions.

4. Originally posted by EvBladeRunnervE
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.

5. 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.

6. 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.
More advanced linear algebra
Code:
```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|```
Code:
```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|```

7. I c. Thx for clearing it up. I know how to do matrix math, but I didn't know how OpenGL did translations with it.

Popular pages Recent additions