I've been using this natvis file in some personal projects that use GLM and I've found it to be very helpful when debugging GLM code.
vectors are displayed in the debugger like this:
glm::vec4 v(1, 2, 3, 4); // [1 2 3 4]
when expanding the view, the debugger will show each individual component, as well as the length of the vector, and hex RGBA code (for float vectors only), like this:
glm::vec4 v(0.5); // [0.5 0.5 0.5 0.5]
[len] 1
[rgba] #7F7F7F7F
x 0.5
y 0.5
z 0.5
w 0.5
Matrices are displayed in row major order when expanded in the debugger like this:
glm::mat4 m = glm::translate(glm::mat4(1), glm::vec3(1, 2, 3));
// [1 0 0 0] [0 1 0 0] [0 0 1 0] [1 2 3 1]
row 1 [1 0 0 1]
row 2 [0 1 0 2]
row 3 [0 0 1 3]
row 4 [0 0 0 1]
columns
- col 1 [1 0 0 0]
- col 2 [0 1 0 0]
- col 3 [0 0 1 0]
- col 4 [1 2 3 1]
Quaternions are displayed as: w + xi + yj + zk
glm::quat q(1, 2, 3, 4); // 1 + 2i + 3j + 4k
Dual quaternions are displayed as:
glm::dualquat dq(q, q); // [r: 1 + 2i + 3j + 4k] [d: 1 + 2i + 3j + 4k]