From ceccd0a2ff94c91955e7e10291a7dbead38b3b49 Mon Sep 17 00:00:00 2001 From: hanfling <13674464+hanfling@users.noreply.github.com> Date: Tue, 8 Nov 2022 04:19:38 +0100 Subject: [PATCH] Two fixes for the SPIRVShader example 1) glm::mat4 default constructor behaviour was changed from identity matrix to undefined data. I updated the code to now use mat(float) ctor to create the identity matrices. 3) Well... a triangle typically consists of 3 vertices, not 9... --- SPIRVShader/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SPIRVShader/main.cpp b/SPIRVShader/main.cpp index f99bd5b..c0f8d09 100644 --- a/SPIRVShader/main.cpp +++ b/SPIRVShader/main.cpp @@ -156,9 +156,9 @@ class OpenGLExample // Update matrices uboVS.projection = glm::perspective(glm::radians(60.0f), (float)1280 / (float)720, 0.1f, 256.0f); - uboVS.view = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + uboVS.view = glm::translate(glm::mat4(1.0), glm::vec3(0.0f, 0.0f, zoom)); - uboVS.model = glm::mat4(); + uboVS.model = glm::mat4(1.0); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); @@ -232,7 +232,7 @@ class OpenGLExample glClearColor(0.0f, 0.0f, 0.2f, 1.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glDrawArrays(GL_TRIANGLES, 0, 9); + glDrawArrays(GL_TRIANGLES, 0, 3); glfwSwapBuffers(window); @@ -357,4 +357,4 @@ int main(void) glfwTerminate(); exit(EXIT_SUCCESS); -} \ No newline at end of file +}