Question: I am writng a program using openGL. When the camera is fixed, how to set the model matrix to make a cube rotate about its

I am writng a program using openGL. When the camera is fixed, how to set the model matrix to make a cube rotate about its Y-axis as well as move in the circle about Z-axis by using OpenGL Mathematics (GLM)? I tried to do

model =glm::rotate(glm::mat4(1.0f), (angle), glm::vec3(0.0, 0.0, 1.0))*glm::translate(glm::mat4(1.0f), glm::vec3(6.0, 0.0, 0.0))*glm::rotate(glm::mat4(1.0f), (angle), glm::vec3(0.0, 1.0, 0.0));

But it does not seem right when i render it? Does anyone know how to make it right?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!