In using GLM, I have been able to use operations on vectors and matrices (+, -, *, /). For some reason in the following line of code, it will not let me do any operations:
glm::vec2 fixedPos = position + dimensions/2; // <- Error is on the '/'
("position" and "dimensions" are both of type "const glm::vec2")
Error: no operator "/" matches these operands; operand types are: const glm::vec2 / int
(replacing "/" with any other math operator will result in the same error)
I find it annoying and strange why this is not working. The error is saying my syntax is incorrect, when what it asks for is what I put! If you see the issue, please post the answer below. Thanks for any help!
Try this:
glm::vec2 fixedPos = position + dimensions / 2.0f;
vec2
is actually a typedef
to highp_vec2
which is a typedef
to tvec2<float, highp>
(cf. glm/detail/type_vec.hpp
)