so i have the orientation of my object stored in a glm::fquat and i want to use it to rotate my model. how do i do that?
i tried this:
glPushMatrix();
glTranslatef(position.x, position.y, position.z);
glMultMatrixf(glm::mat4_cast(orientation));
glCallList(modelID);
glPopMatrix();
but i got this error:
error: cannot convert 'glm::detail::tmat4x4<float>' to 'const GLfloat* {aka const float*}' for argument '1' to 'void glMultMatrixf(const GLfloat*)'|
im obviously doing something wrong so whats the correct way to do it?
GLM won't/can't(?) automagically cast a mat4
to GLfloat*
so you have to help it along a bit.
Try this:
#include <glm/gtc/type_ptr.hpp>
glMultMatrixf( glm::value_ptr( glm::mat4_cast(orientation) ) );
This might also work:
glMultMatrixf( &glm::mat4_cast(orientation)[0][0] );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With