From e7382fdfb018c8106c12472e80a81757c5954c8a Mon Sep 17 00:00:00 2001 From: Charles Zhang Date: Thu, 29 Jun 2017 18:37:08 +0800 Subject: [PATCH 1/2] fix texture1 uniform name & two shader variables --- src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp b/src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp index db600d2..4a7a85f 100644 --- a/src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp +++ b/src/4.advanced_opengl/2.stencil_testing/stencil_testing.cpp @@ -170,7 +170,7 @@ int main() // shader configuration // -------------------- shader.use(); - shader.setInt("ourTexture", 0); + shader.setInt("texture1", 0); // render loop // ----------- @@ -243,12 +243,12 @@ int main() model = glm::mat4(); model = glm::translate(model, glm::vec3(-1.0f, 0.0f, -1.0f)); model = glm::scale(model, glm::vec3(scale, scale, scale)); - shader.setMat4("model", model); + shaderSingleColor.setMat4("model", model); glDrawArrays(GL_TRIANGLES, 0, 36); model = glm::mat4(); model = glm::translate(model, glm::vec3(2.0f, 0.0f, 0.0f)); model = glm::scale(model, glm::vec3(scale, scale, scale)); - shader.setMat4("model", model); + shaderSingleColor.setMat4("model", model); glDrawArrays(GL_TRIANGLES, 0, 36); glBindVertexArray(0); glStencilMask(0xFF); From c4c5fea21886be94e3c24beae664a73455c5b440 Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 4 Jul 2017 13:40:47 +0300 Subject: [PATCH 2/2] Changed MSVC std::sqrtf call to simple std::sqrt - causes compile failure on mingw toolchain, as no such fucntion is present. --- .../8.2.deferred_shading_volumes/deferred_shading_volumes.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/5.advanced_lighting/8.2.deferred_shading_volumes/deferred_shading_volumes.cpp b/src/5.advanced_lighting/8.2.deferred_shading_volumes/deferred_shading_volumes.cpp index e7c4b5e..75c0c4e 100644 --- a/src/5.advanced_lighting/8.2.deferred_shading_volumes/deferred_shading_volumes.cpp +++ b/src/5.advanced_lighting/8.2.deferred_shading_volumes/deferred_shading_volumes.cpp @@ -224,7 +224,7 @@ int main() shaderLightingPass.setFloat("lights[" + std::to_string(i) + "].Quadratic", quadratic); // then calculate radius of light volume/sphere const float maxBrightness = std::fmaxf(std::fmaxf(lightColors[i].r, lightColors[i].g), lightColors[i].b); - float radius = (-linear + std::sqrtf(linear * linear - 4 * quadratic * (constant - (256.0f / 5.0f) * maxBrightness))) / (2.0f * quadratic); + float radius = (-linear + std::sqrt(linear * linear - 4 * quadratic * (constant - (256.0f / 5.0f) * maxBrightness))) / (2.0f * quadratic); shaderLightingPass.setFloat("lights[" + std::to_string(i) + "].Radius", radius); } shaderLightingPass.setVec3("viewPos", camera.Position);