首页 > 代码库 > 使用GLM时无法找到glm::lookAt()的错误

使用GLM时无法找到glm::lookAt()的错误

glm::mat4 View       = glm::lookAt(    glm::vec3(4,3,3), // Camera is at (4,3,3), in World Space    glm::vec3(0,0,0), // and looks at the origin    glm::vec3(0,1,0)  // Head is up (set to 0,-1,0 to look upside-down));

编译时显示 “glm没有成员lookAt()“;

 

原因: lookAt() 并非定义在glm的core模块中,需要同时引用matrix_transform扩展。

 

#include <glm/gtc/matrix_transform.hpp>