所以我将对象的方向存储在 glm::fquat 中,我想用它来旋转我的模型。我怎么做?
我试过这个:
glPushMatrix();
glTranslatef(position.x, position.y, position.z);
glMultMatrixf(glm::mat4_cast(orientation));
glCallList(modelID);
glPopMatrix();
但我收到了这个错误:
error: cannot convert 'glm::detail::tmat4x4<float>' to 'const GLfloat* {aka const float*}' for argument '1' to 'void glMultMatrixf(const GLfloat*)'|
我显然做错了什么,那么正确的方法是什么?
GLM 不会/不能(?)自动投射mat4
to GLfloat*
so 你必须帮助它一点 http://www.g-truc.net/post-0265.html.
尝试这个:
#include <glm/gtc/type_ptr.hpp>
glMultMatrixf( glm::value_ptr( glm::mat4_cast(orientation) ) );
这也可能有效:
glMultMatrixf( &glm::mat4_cast(orientation)[0][0] );
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)