Vector4f

Hey

In LWJGL, You have Vector2f (or others for doubles, ints etc), Vector3f, then Vector4f

For the life of me, I can’t fathom what you’d need the 4th value for?

It’s for all those inter-dimensional maths!

Jokes aside, I’d like to find out as well.

When you make a transformation matrix in 3D it is always a 4x4.
This means that you need a vector 4f to multiply it :slight_smile:

Also one often uses the 4th number to differ between vectors and points

It can represent the ‘w’ value in a position or rotation, or it can be used for something else, like a color’s alpha value.

Homogeneous coordinates

Short answer: Unless you’re writing a renderer from scratch, you probably don’t need to know right now.

You could use a Vector4f to store a color (Red, Green, Blue, Alpha).

Sweet, thanks. I always wondered:P