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

Printable View

- 11-24-2003frenchfry164glVertex4f
I noticed that there is a glVertex4f. The fourth parameter is w. What is w used for?

- 11-26-2003sic1
hmm, weight?

- 11-26-2003EvBladeRunnervE
the coordinate 'w' is used for quaternions.

- 11-26-2003gradyQuote:

*Originally posted by EvBladeRunnervE*

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

- 11-28-2003frenchfry164
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-2003gradyQuote:

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

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|

- 11-29-2003frenchfry164
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.