Add exercise3 of coordiante systems chapter to repo.

This commit is contained in:
Joey de Vries
2020-05-08 22:03:53 +02:00
parent 9a582d850c
commit d67c29e9d8

View File

@@ -0,0 +1,19 @@
...
glBindVertexArray(VAO);
for(unsigned int i = 0; i < 10; i++)
{
// calculate the model matrix for each object and pass it to shader before drawing
glm::mat4 model = glm::mat4(1.0f);
model = glm::translate(model, cubePositions[i]);
float angle = 20.0f * i;
if(i % 3 == 0) // every 3rd iteration (including the first) we set the angle using GLFW's time function.
angle = glfwGetTime() * 25.0f;
model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));
ourShader.setMat4("model", model);
glDrawArrays(GL_TRIANGLES, 0, 36);
}
...