1
0
Fork 0

Add object rotation by timer

This commit is contained in:
Meoweg 2015-11-07 15:52:07 +00:00
parent 1bfeb9e99d
commit 6ba5794ea2
1 changed files with 5 additions and 0 deletions

View File

@ -72,6 +72,7 @@ int main()
teapot1 = new Object(*teapot);
teapot1->position.x = -2.0;
teapot1->position.z = 1.0;
teapot1->rotation.z = 45;
bunny1 = new Object(*bunny);
@ -132,6 +133,10 @@ void iterate()
pos_y -= 0.1 * sin(glm::radians(delta_z));
}
suzanne1->rotation.y = glfwGetTime() * 360 / 4;
teapot1->rotation.x = glfwGetTime() * 360 / 6;
bunny1->rotation.z = glfwGetTime() * 360 / 2;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glm::mat4 model = glm::translate(glm::mat4(1.0f), glm::vec3(-pos_x, -pos_y, -2.0f));