4x4 matrix in glm

I have browsed for an answer to this very simple question for quite some time, but the docs and forums all have incloncusive, contradictory or ambigious answers.

How do I declare THIS


simple 4x4 matrix using the glm library?

glm::mat4x4 simpleMat/* = ??? */;

Direct initialisation:
glm::mat4x4 matrix1(1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16);

List initialisation:
glm::mat4x4 matrix2 = {1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16};

Aggregate initialisation:
glm::mat4x4 matrix3{1,2,3,4, 5,6,7,8, 9,10,11,12, 13,14,15,16};

While there can be differences between the two forms (depending upon the C++ version), I believe that the only factor which applies here is that some forms are more restrictive about narrowing casts than others.

See e.g. this link for the details of initialisation rules in various C++ versions.

Thank you for your detailed answer

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.