I noticed that there is a glVertex4f. The fourth parameter is w. What is w used for?
I noticed that there is a glVertex4f. The fourth parameter is w. What is w used for?
hmm, weight?
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.Originally posted by EvBladeRunnervE
the coordinate 'w' is used for quaternions.
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.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|
Last edited by grady; 11-29-2003 at 03:01 PM.
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.