From 4dc5862c12e249fb1c5a4753ac13c99eaaf99905 Mon Sep 17 00:00:00 2001 From: Phillip Chang Date: Wed, 5 May 2021 23:46:21 +0900 Subject: [PATCH 1/4] Fix bug: glDisable(GL_DEPTH) -> glDisable(GL_DEPTH_TEST) --- src/8.guest/2020/oit/weighted_blended.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/8.guest/2020/oit/weighted_blended.cpp b/src/8.guest/2020/oit/weighted_blended.cpp index 0030244..b382f37 100644 --- a/src/8.guest/2020/oit/weighted_blended.cpp +++ b/src/8.guest/2020/oit/weighted_blended.cpp @@ -273,7 +273,7 @@ int main(int argc, char* argv[]) // ----- // set render states - glDisable(GL_DEPTH); + glDisable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); // enable depth writes so glClear won't ignore clearing the depth buffer glDisable(GL_BLEND); @@ -379,4 +379,4 @@ glm::mat4 calculate_model_matrix(const glm::vec3& position, const glm::vec3& rot trans = glm::scale(trans, scale); return trans; -} \ No newline at end of file +} From c976eee7ea81627f8cccc94f1582bf1e194af2bd Mon Sep 17 00:00:00 2001 From: gonnavis Date: Thu, 6 May 2021 17:26:13 +0800 Subject: [PATCH 2/4] Fix typo: nominator to numerator. --- src/6.pbr/1.1.lighting/1.1.pbr.fs | 4 ++-- src/6.pbr/1.2.lighting_textured/1.2.pbr.fs | 4 ++-- src/6.pbr/2.1.1.ibl_irradiance_conversion/2.1.1.pbr.fs | 4 ++-- src/6.pbr/2.1.2.ibl_irradiance/2.1.2.pbr.fs | 4 ++-- src/6.pbr/2.2.1.ibl_specular/2.2.1.pbr.fs | 4 ++-- src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.pbr.fs | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/6.pbr/1.1.lighting/1.1.pbr.fs b/src/6.pbr/1.1.lighting/1.1.pbr.fs index dce7c32..4a807df 100644 --- a/src/6.pbr/1.1.lighting/1.1.pbr.fs +++ b/src/6.pbr/1.1.lighting/1.1.pbr.fs @@ -84,9 +84,9 @@ void main() float G = GeometrySmith(N, V, L, roughness); vec3 F = fresnelSchlick(clamp(dot(H, V), 0.0, 1.0), F0); - vec3 nominator = NDF * G * F; + vec3 numerator = NDF * G * F; float denominator = 4 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0); - vec3 specular = nominator / max(denominator, 0.001); // prevent divide by zero for NdotV=0.0 or NdotL=0.0 + vec3 specular = numerator / max(denominator, 0.001); // prevent divide by zero for NdotV=0.0 or NdotL=0.0 // kS is equal to Fresnel vec3 kS = F; diff --git a/src/6.pbr/1.2.lighting_textured/1.2.pbr.fs b/src/6.pbr/1.2.lighting_textured/1.2.pbr.fs index 950594e..e08ec81 100644 --- a/src/6.pbr/1.2.lighting_textured/1.2.pbr.fs +++ b/src/6.pbr/1.2.lighting_textured/1.2.pbr.fs @@ -111,9 +111,9 @@ void main() float G = GeometrySmith(N, V, L, roughness); vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0); - vec3 nominator = NDF * G * F; + vec3 numerator = NDF * G * F; float denominator = 4 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0) + 0.001; // 0.001 to prevent divide by zero. - vec3 specular = nominator / denominator; + vec3 specular = numerator / denominator; // kS is equal to Fresnel vec3 kS = F; diff --git a/src/6.pbr/2.1.1.ibl_irradiance_conversion/2.1.1.pbr.fs b/src/6.pbr/2.1.1.ibl_irradiance_conversion/2.1.1.pbr.fs index 49ad11f..c6ff0e9 100644 --- a/src/6.pbr/2.1.1.ibl_irradiance_conversion/2.1.1.pbr.fs +++ b/src/6.pbr/2.1.1.ibl_irradiance_conversion/2.1.1.pbr.fs @@ -85,9 +85,9 @@ void main() float G = GeometrySmith(N, V, L, roughness); vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0); - vec3 nominator = NDF * G * F; + vec3 numerator = NDF * G * F; float denominator = 4 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0) + 0.001; // 0.001 to prevent divide by zero. - vec3 specular = nominator / denominator; + vec3 specular = numerator / denominator; // kS is equal to Fresnel vec3 kS = F; diff --git a/src/6.pbr/2.1.2.ibl_irradiance/2.1.2.pbr.fs b/src/6.pbr/2.1.2.ibl_irradiance/2.1.2.pbr.fs index 1808885..b4d7d57 100644 --- a/src/6.pbr/2.1.2.ibl_irradiance/2.1.2.pbr.fs +++ b/src/6.pbr/2.1.2.ibl_irradiance/2.1.2.pbr.fs @@ -88,9 +88,9 @@ void main() float G = GeometrySmith(N, V, L, roughness); vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0); - vec3 nominator = NDF * G * F; + vec3 numerator = NDF * G * F; float denominator = 4 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0) + 0.001; // 0.001 to prevent divide by zero. - vec3 specular = nominator / denominator; + vec3 specular = numerator / denominator; // kS is equal to Fresnel vec3 kS = F; diff --git a/src/6.pbr/2.2.1.ibl_specular/2.2.1.pbr.fs b/src/6.pbr/2.2.1.ibl_specular/2.2.1.pbr.fs index 9033c12..03ea9ed 100644 --- a/src/6.pbr/2.2.1.ibl_specular/2.2.1.pbr.fs +++ b/src/6.pbr/2.2.1.ibl_specular/2.2.1.pbr.fs @@ -95,9 +95,9 @@ void main() float G = GeometrySmith(N, V, L, roughness); vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0); - vec3 nominator = NDF * G * F; + vec3 numerator = NDF * G * F; float denominator = 4 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0) + 0.001; // 0.001 to prevent divide by zero. - vec3 specular = nominator / denominator; + vec3 specular = numerator / denominator; // kS is equal to Fresnel vec3 kS = F; diff --git a/src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.pbr.fs b/src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.pbr.fs index 7d3be29..e35ebec 100644 --- a/src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.pbr.fs +++ b/src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.pbr.fs @@ -124,9 +124,9 @@ void main() float G = GeometrySmith(N, V, L, roughness); vec3 F = fresnelSchlick(max(dot(H, V), 0.0), F0); - vec3 nominator = NDF * G * F; + vec3 numerator = NDF * G * F; float denominator = 4 * max(dot(N, V), 0.0) * max(dot(N, L), 0.0) + 0.001; // 0.001 to prevent divide by zero. - vec3 specular = nominator / denominator; + vec3 specular = numerator / denominator; // kS is equal to Fresnel vec3 kS = F; From b7a196ba4a6a377ea8717a37bac7d21371e5bbba Mon Sep 17 00:00:00 2001 From: cyaneko <41419822+cyaneko@users.noreply.github.com> Date: Thu, 19 Aug 2021 21:10:57 +0200 Subject: [PATCH 3/4] Fix a minor bug in rear view mirror Rotating both the Yaw and Pitch would cause the mirror to display whatever was in front but with Pitch * -1, this fixes this behaviour. Tested. --- .../5.2.framebuffers_exercise1/framebuffers_exercise1.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp b/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp index 2682a96..c6d30d5 100644 --- a/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp +++ b/src/4.advanced_opengl/5.2.framebuffers_exercise1/framebuffers_exercise1.cpp @@ -250,11 +250,9 @@ int main() shader.use(); 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) glm::mat4 view = camera.GetViewMatrix(); camera.Yaw -= 180.0f; // reset it back to its original orientation - camera.Pitch -= 180.0f; camera.ProcessMouseMovement(0, 0, true); glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f); shader.setMat4("view", view); From c85067d4fedf2dba1a1c606274d757a55d3f7b56 Mon Sep 17 00:00:00 2001 From: Jelle Vos Date: Sat, 28 Aug 2021 19:04:33 +0200 Subject: [PATCH 4/4] Update textures.cpp On line 109 glGenerateMipmap is getting called but the GL_TEXTURE_MIN_FILTER uses GL_LINEAR. Changed it to GL_LINEAR_MIPMAP_LINEAR --- src/1.getting_started/4.1.textures/textures.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/1.getting_started/4.1.textures/textures.cpp b/src/1.getting_started/4.1.textures/textures.cpp index 6752e89..1605f20 100644 --- a/src/1.getting_started/4.1.textures/textures.cpp +++ b/src/1.getting_started/4.1.textures/textures.cpp @@ -97,7 +97,7 @@ int main() glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // set texture wrapping to GL_REPEAT (default wrapping method) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); // set texture filtering parameters - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // load image, create texture and generate mipmaps int width, height, nrChannels; @@ -169,4 +169,4 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height) // make sure the viewport matches the new window dimensions; note that width and // height will be significantly larger than specified on retina displays. glViewport(0, 0, width, height); -} \ No newline at end of file +}