Hi everybody!
How should I cast a glm::vec2 to glm::ivec2? or vice versa.
I guess this is not correct
glm::vec2 v=glm::vec2(1.0,1.0)+(glm::vec)glm::ivec2(2,2);
What do you think? BTW, I’m using GLM math library.
Thanks a lot for your help.
Hi everybody!
How should I cast a glm::vec2 to glm::ivec2? or vice versa.
I guess this is not correct
glm::vec2 v=glm::vec2(1.0,1.0)+(glm::vec)glm::ivec2(2,2);
What do you think? BTW, I’m using GLM math library.
Thanks a lot for your help.
You are missing a “2” in your cast. Replace “(glm::vec)” in the cast to “(glm::vec2)” as
glm::vec2 v=glm::vec2(1.0,1.0)+(glm::vec2)glm::ivec2(2,2);
and to go in reverse
glm::ivec2 v=(glm::ivec2)glm::vec2(1.0,1.0)+glm::ivec2(2,2);