I have a glm::mat3
constructed via the experimental glm::translate(mat3,vec2)
function. However, using this matrix to modify a vec3 gives funky results. Here is a short program demonstrating:
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/glm.hpp>
#include <glm/gtx/matrix_transform_2d.hpp>
#include <iostream>
std::ostream& operator<< (std::ostream& o, const glm::vec3& vec){
return o << '(' << vec.x << ',' << vec.y << ',' << vec.z << ")\n";
}
int main(){
glm::mat3 translate = glm::translate(glm::mat3(1.), glm::vec2(-1.,-1.));
std::cout << glm::vec3(10.,10.,1.); //prints (10,10,1)
std::cout << glm::vec3(10.,10.,1.) * translate; //prints (10,10,-19)
}
What is wrong with my matrix that is causing it to modify the Z coordinate instead of translating it?