stackgl / shader-school

:mortar_board: A workshopper for GLSL shaders and graphics programming
Other
4.27k stars 251 forks source link

Intro-6 (matrices): Code example for retrieving matrix' column as vector #162

Closed fabianwulf closed 7 years ago

fabianwulf commented 7 years ago

Hey everyone,

first of all thanks for providing such a great tool to learn GLSL in a very motivational way!

I am fairly new to this subject and stumbled across one confusing bit in exercise intro-6 (matrices) I wanted to sort out for myself by asking:

At the beginning of the exercise you mention that

matrix constructors are in column major order.

Later on there is this code example how to store specific columns of a matrix into a vector like:

mat3 m = mat3(1.1, 2.1, 3.1,
              1.2, 2.2, 3.2,
              1.3, 2.3, 3.3);

//Read out first column of m
vec3 a = m[0];

//Now: a = vec3(1.1, 2.1, 3.1);

When storing the first column inside the new vec3 a, wouldn't it's value rather be vec3(1.1, 1.2, 1.3) than vec3(1.1, 2.1, 3.1)?

Just wondering.

Best regards, Fabian

fabianwulf commented 7 years ago

Ok, I've had an insightful moment when looking inside the OpenGL wiki and gonna close this "issue" again, so please ignore it. 😅

Cheers!