-2

I am trying to normalise the vector by calling glm::vec3(x,y,z) = glm::normalize(glm::vec3(x,y,z)) but when I print the new x,y,z they seems not correct since some values bigger than 1

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Fiona H
  • 1
  • 1

1 Answers1

1

When you do:

glm::vec3(x,y,z) = glm::normalize(glm::vec3(x,y,z));

you are creating a temporary and assignint to it the results of normalization. At the end of instruction, the temporary will be deleted.

In order to this to work, try something like this:

glm::vec3 v = glm::normalize(glm::vec3(x,y,z));

and look for values in v.x, v.y, and v.z

Amadeus
  • 10,199
  • 3
  • 25
  • 31