Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm casting a glm type to an normal array using glm::value_ptr() as follows

glm::vec4 position;
glm::mat3 orient;

...

glm::mat4 transformMatrix=glm::translate( glm::mat4(orient) , glm::vec3(position));
float *p=glm::value_ptr(transformMatrix);

However I'm getting this compile error:

error: invalid cast from type 'const glm::detail::tvec3<float>' to type 'float'|

Any help?

share|improve this question
The first value_ptr of a glm::matN is a glm::vecN, e.g. the matrix consists of N glm::vecN. So, value pointer gets you the first vector in the matrix. To get the first element of the matrix, you'll have to get the first element of the first vector. – sarahm Mar 5 at 9:21

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.