Hi, I wonder what is ofVec2f::set
alternative in glm::vec2
.
If you have a glm::vec2
called vector
, you can change/set the values in a couple of different ways.
auto vector = glm::vec2(10, 20);
cout << vector << endl;
//prints 10, 20
vector.x = 40;
vector.y = 100;
cout << vector << endl;
//prints 40, 100
vector = glm::vec2(100, 100);
cout << vector << endl;
//prints 100, 100
I don’t think there’s a direct equivalent to ofVec2f::set
but those should suffice. Otherwise, you could also make your own function quite easily I think
2 Likes
I’d like to point out the list initializers.
glm::vec2 v1 = {1.0, 0.3333};
glm::vec2 v2;
v2 = {1.0, 0.3333};
simply put in between the curly braces what you would put in a constructor method.
2 Likes