PDA

View Full Version : Fatal bug in GLM getting started code example



-0x80
07-11-2011, 02:04 AM
I used the bit of code from the getting started page just to see if it compiled ok, and it actually triggered an assertion. It looks like the code on the getting started page has a bug:
http://glm.g-truc.net/api-0.9.2/a00001.html

The pdf manual has the same example but with the correct index to Model [] operator, 3 instead of 4.

This is the code from the getting started page:

glm::vec4 Position = glm::vec4(glm::vec3(0.0), 1.0);
glm::mat4 Model = glm::mat4(1.0);
Model[4] = glm::vec4(1.0, 1.0, 0.0, 1.0);
glm::vec4 Transformed = Model * Position;

A nice way to confuse newcomers ;)

Groovounet
07-11-2011, 03:46 AM
Duplicating the manual in the API was maybe not such a great idea... :p