mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Update GLM to latest version (0.9.9.3). This includes GLM's change of matrices no longer default initializing to the identity matrix. This commit thus also includes the update of all of LearnOpenGL's code to reflect this: all matrices are now constructor-initialized to the identity matrix where relevant.
This commit is contained in:
@@ -248,7 +248,7 @@ int main()
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
shader.use();
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
camera.Yaw += 180.0f; // rotate the camera's yaw 180 degrees around
|
||||
camera.Pitch += 180.0f; // rotate the camera's pitch 180 degrees around
|
||||
camera.ProcessMouseMovement(0, 0, false); // call this to make sure it updates its camera vectors, note that we disable pitch constrains for this specific case (otherwise we can't reverse camera's pitch values)
|
||||
@@ -266,14 +266,14 @@ int main()
|
||||
model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));
|
||||
shader.setMat4("model", model);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 36);
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));
|
||||
shader.setMat4("model", model);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 36);
|
||||
// floor
|
||||
glBindVertexArray(planeVAO);
|
||||
glBindTexture(GL_TEXTURE_2D, floorTexture);
|
||||
shader.setMat4("model", glm::mat4());
|
||||
shader.setMat4("model", glm::mat4(1.0f));
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
glBindVertexArray(0);
|
||||
|
||||
@@ -284,7 +284,7 @@ int main()
|
||||
glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
view = camera.GetViewMatrix();
|
||||
shader.setMat4("view", view);
|
||||
|
||||
@@ -295,14 +295,14 @@ int main()
|
||||
model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f));
|
||||
shader.setMat4("model", model);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 36);
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f));
|
||||
shader.setMat4("model", model);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 36);
|
||||
// floor
|
||||
glBindVertexArray(planeVAO);
|
||||
glBindTexture(GL_TEXTURE_2D, floorTexture);
|
||||
shader.setMat4("model", glm::mat4());
|
||||
shader.setMat4("model", glm::mat4(1.0f));
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
glBindVertexArray(0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user