g-truc / glm

OpenGL Mathematics (GLM)
https://glm.g-truc.net
Other
9.34k stars 2.14k forks source link

are there any gdb pretty printers for the glm library? #1282

Open asmwarrior opened 8 months ago

asmwarrior commented 8 months ago

Hi, when debugging a program with glm library, I would like to see the vectors or matrices in the gdb.

But sometimes, a simple vector shows several duplicated values, see below:

[debug]> output element.pos
[debug]{{x = 0, r = 0, s = 0}, {y = 0.5, g = 0.5, t = 0.5}, {z = 0, b = 0, p = 0}}>>>>>>cb_gdb:

The result visualized window is like the image below under code::blocks IDE:

image

What I think is that I only need tree values: x,y,z for a simple vec3.

[debug]> output axisTransform_scaled
[debug]{value = {{{x = -0.017251512, r = -0.017251512, s = -0.017251512}, {y = -0.017251512, g = -0.017251512, t = -0.017251512}, {z = -0.017251512, b = -0.017251512, p = -0.017251512}, {w = -0.017251512, a = -0.017251512, q = -0.017251512}}, {{x = -0.017251512, r = -0.017251512, s = -0.017251512}, {y = -0.017251512, g = -0.017251512, t = -0.017251512}, {z = -0.017251512, b = -0.017251512, p = -0.017251512}, {w = -0.017251512, a = -0.017251512, q = -0.017251512}}, {{x = -0.017251512, r = -0.017251512, s = -0.017251512}, {y = -0.017251512, g = -0.017251512, t = -0.017251512}, {z = -0.017251512, b = -0.017251512, p = -0.017251512}, {w = -0.017251512, a = -0.017251512, q = -0.017251512}}, {{x = -0.00132703932, r = -0.00132703932, s = -0.00132703932}, {y = -0.00132703932, g = -0.00132703932, t = -0.00132703932}, {z = -0.00132703932, b = -0.00132703932, p = -0.00132703932}, {w = -0.00132703932, a = -0.00132703932, q = -0.00132703932}}}}>>>>>>cb_gdb:

If I try to print a mat4, it becomes more complex with many duplicated values.

Any ideas?

Thanks.

kaikai23 commented 5 months ago

I have met exactly the same issue. Any solutions to show the actual values for a glm::vec3 in gdb?