What's the point of translating vertors is OpenGL wants matrices?

Started by Mihai_Ionut_Floares, December 03, 2020, 17:36:39

Previous topic - Next topic

Mihai_Ionut_Floares

I found this online and I don't understand why would we want to translate a vector:


"So if we want to translate the vector (10,10,10,1) of 10 units in the X direction, we get :

"


KaiHH

The point of this tutorial http://www.opengl-tutorial.org/beginners-tutorials/tutorial-3-matrices/#translation-matrices is to illustrate how matrices work.
When using matrices practically in OpenGL, you are basically translating and scaling vectors _all the time_. It's just that it's not _you_ who does this, but the graphics card. You provide the GPU with matrices that translate, scale and rotate vertices. And the "position" component of a vertex is simply a vector, which is multiplied by the matrix. And if the matrix had a translational component to it, then that vector would get translated.

Mihai_Ionut_Floares

If GPU works with vectors why we(humans) need to work with matrices. It is a lot easier to work with vectors than matrices...

KaiHH

Quote from: Mihai_Ionut_Floares on December 03, 2020, 18:34:45
If GPU works with vectors why we(humans) need to work with matrices. It is a lot easier to work with vectors than matrices...
What?!
Matrices are a way to _encode_ transformations (translation, scaling, rotation) performed on vectors. Nothing more, nothing less.
If you want your models in the scene to show up somewhere else, be rotated a bit and scaled down, you _encode_ this information into a matrix, as simple as that.