我正在尝试将glm中的四元数转换为mat4。
我的代码如下:
#include <iostream>
#include<glm/glm.hpp>
#include<glm/gtc/quaternion.hpp>
#include<glm/common.hpp>
using namespace std;
int main()
{
glm::mat4 MyMatrix=glm::mat4();
glm::quat myQuat;
myQuat=glm::quat(0.707107,0.707107,0.00,0.000);
glm::mat4 RotationMatrix = quaternion::toMat4(myQuat);
for(int i=0;i<4;++i)
{
for(int j=0;j<4;++j)
{
cout<<RotationMatrix[i][j]<<" ";
}
cout<<"\n";
}
return 0;
}
当我运行程序时,它显示错误“error:‘quaternion’未声明”。 有人能帮我解决这个问题吗?
quaternion::toMat4
替换为glm::quaternion::toMat4
吗? - NathanOliver