From 64e7bb1e94f50a6dcd0fb752274c4586d05d90b7 Mon Sep 17 00:00:00 2001 From: Tleety Date: Tue, 9 Feb 2016 16:19:17 +0100 Subject: [PATCH] Good looking blur, need some fixes, but framerates takes a huge hit. --- include/Engine/Rendering/DrawBloomPass.h | 14 ++- resources/Shaders/Gaussian_both.frag.glsl | 36 +++++++ resources/Shaders/Gaussian_both.vert.glsl | 13 +++ resources/Shaders/Gaussian_horiz.frag.glsl | 10 +- resources/Shaders/Gaussian_vert.frag.glsl | 10 +- resources/Shaders/TextureCombine.frag.glsl | 21 ++++ resources/Shaders/TextureCombine.vert.glsl | 13 +++ src/Engine/Rendering/DrawBloomPass.cpp | 118 ++++++++++++++++++--- src/Engine/Rendering/DrawFinalPass.cpp | 9 +- 9 files changed, 220 insertions(+), 24 deletions(-) create mode 100644 resources/Shaders/Gaussian_both.frag.glsl create mode 100644 resources/Shaders/Gaussian_both.vert.glsl create mode 100644 resources/Shaders/TextureCombine.frag.glsl create mode 100644 resources/Shaders/TextureCombine.vert.glsl diff --git a/include/Engine/Rendering/DrawBloomPass.h b/include/Engine/Rendering/DrawBloomPass.h index 539d6957..870ed2a7 100644 --- a/include/Engine/Rendering/DrawBloomPass.h +++ b/include/Engine/Rendering/DrawBloomPass.h @@ -8,6 +8,7 @@ #include "ShaderProgram.h" //#include "Util/UnorderedMapVec2.h" #include "Texture.h" +#include "imgui/imgui.h" class DrawBloomPass { @@ -26,27 +27,36 @@ public: //Getters //Return the blurred result of the texture that was sent into draw - GLuint GaussianTexture() const { return m_GaussianTexture_vert; } + GLuint GaussianTexture() const { return m_FinalBlurTexture; } private: void GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const; + void BlurOneMipMapLevel(GLuint* texture, GLint iterations, GLint mipMapLevel); Texture* m_WhiteTexture; Model* m_ScreenQuad; const IRenderer* m_Renderer; //const LightCullingPass* m_LightCullingPass - GLuint m_iterations = 9; + //GLuint m_iterations = 5; + GLint m_DebugTextureToDraw = 0; + GLint m_Iterations = 3; + float m_ScreenSizes[10]; + + GLuint m_FinalBlurTexture; GLuint m_GaussianTexture_horiz; GLuint m_GaussianTexture_vert; FrameBuffer m_GaussianFrameBuffer_horiz; FrameBuffer m_GaussianFrameBuffer_vert; + FrameBuffer m_BlurredFinalTexture; ShaderProgram* m_GaussianProgram_horiz; ShaderProgram* m_GaussianProgram_vert; + ShaderProgram* m_GaussianProgram_both; + ShaderProgram* m_CombineProgram; }; diff --git a/resources/Shaders/Gaussian_both.frag.glsl b/resources/Shaders/Gaussian_both.frag.glsl new file mode 100644 index 00000000..23f53385 --- /dev/null +++ b/resources/Shaders/Gaussian_both.frag.glsl @@ -0,0 +1,36 @@ +#version 430 +#extension GL_EXT_gpu_shader4 : enable + +uniform int MipMapLevel; +uniform bool Horizontal; +uniform vec2 ScreenSize[5]; + +layout (binding = 0) uniform sampler2D Texture; + +in VertexData{ + vec2 TextureCoordinate; +}Input; + +out vec4 fragmentColor; + +uniform float offset[3] = float[]( 0.0, 1.3846153846, 3.2307692308 ); +uniform float weight[5] = float[]( 0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 0.0162162162 ); + +void main() +{ + //vec2 tex_offset = 1.0 / textureSize2D(Texture, 0); + vec3 result = textureLod(Texture, vec2(gl_FragCoord)/ScreenSize[0], MipMapLevel ).rgb * weight[0]; + + if(Horizontal) { + for( int i = 1; i<3; i++) { + result += textureLod( Texture, Input.TextureCoordinate + vec2(offset[i], 0.0), MipMapLevel ).rgb * weight[i]; + result += textureLod( Texture, Input.TextureCoordinate - vec2(offset[i], 0.0), MipMapLevel ).rgb * weight[i]; + } + } else { + for( int i = 1; i<3; i++) { + result += textureLod( Texture, Input.TextureCoordinate + vec2(0.0, offset[i]), MipMapLevel ).rgb * weight[i]; + result += textureLod( Texture, Input.TextureCoordinate - vec2(0.0, offset[i]), MipMapLevel ).rgb * weight[i]; + } + } + fragmentColor = vec4(result, 1.0); +} \ No newline at end of file diff --git a/resources/Shaders/Gaussian_both.vert.glsl b/resources/Shaders/Gaussian_both.vert.glsl new file mode 100644 index 00000000..346bc141 --- /dev/null +++ b/resources/Shaders/Gaussian_both.vert.glsl @@ -0,0 +1,13 @@ +#version 430 + +layout (location = 0) in vec3 Position; + +out VertexData{ + vec2 TextureCoordinate; +}Output; + +void main() +{ + gl_Position = vec4(Position, 1.0); + Output.TextureCoordinate = (vec2(Position) + 1) / 2; +} \ No newline at end of file diff --git a/resources/Shaders/Gaussian_horiz.frag.glsl b/resources/Shaders/Gaussian_horiz.frag.glsl index 6a9572c2..488cb54d 100644 --- a/resources/Shaders/Gaussian_horiz.frag.glsl +++ b/resources/Shaders/Gaussian_horiz.frag.glsl @@ -1,6 +1,7 @@ #version 430 #extension GL_EXT_gpu_shader4 : enable +uniform int MipMapLevel; layout (binding = 0) uniform sampler2D Texture; in VertexData{ @@ -14,11 +15,14 @@ uniform float weight[5] = float[](0.227027, 0.1945946, 0.1216216, 0.054054, 0.01 void main() { vec2 tex_offset = 1.0 / textureSize2D(Texture, 0); - vec3 result = texture(Texture, Input.TextureCoordinate).rgb * weight[0]; + vec3 result = textureLod(Texture, Input.TextureCoordinate, MipMapLevel).rgb * weight[0]; + //vec3 result = texture(Texture, Input.TextureCoordinate).rgb * weight[0]; for(int i = 1; i < 5; ++i) { - result += texture(Texture, Input.TextureCoordinate + vec2(tex_offset.x * i, 0.0)).rgb * weight[i]; - result += texture(Texture, Input.TextureCoordinate - vec2(tex_offset.x * i, 0.0)).rgb * weight[i]; + result += textureLod(Texture, Input.TextureCoordinate + vec2(tex_offset.x * i, 0.0), MipMapLevel).rgb * weight[i]; + result += textureLod(Texture, Input.TextureCoordinate - vec2(tex_offset.x * i, 0.0), MipMapLevel).rgb * weight[i]; + //result += texture(Texture, Input.TextureCoordinate + vec2(tex_offset.x * i, 0.0)).rgb * weight[i]; + //result += texture(Texture, Input.TextureCoordinate - vec2(tex_offset.x * i, 0.0)).rgb * weight[i]; } fragmentColor = vec4(result, 1.0); } \ No newline at end of file diff --git a/resources/Shaders/Gaussian_vert.frag.glsl b/resources/Shaders/Gaussian_vert.frag.glsl index 8b0e861a..164af8dd 100644 --- a/resources/Shaders/Gaussian_vert.frag.glsl +++ b/resources/Shaders/Gaussian_vert.frag.glsl @@ -1,6 +1,7 @@ #version 430 #extension GL_EXT_gpu_shader4 : enable +uniform int MipMapLevel; layout (binding = 0) uniform sampler2D Texture; in VertexData{ @@ -14,11 +15,14 @@ uniform float weight[5] = float[](0.227027, 0.1945946, 0.1216216, 0.054054, 0.01 void main() { vec2 tex_offset = 1.0 / textureSize2D(Texture, 0); - vec3 result = texture(Texture, Input.TextureCoordinate).rgb * weight[0]; + //vec3 result = texture(Texture, Input.TextureCoordinate).rgb * weight[0]; + vec3 result = textureLod(Texture, Input.TextureCoordinate, MipMapLevel).rgb * weight[0]; for(int i = 1; i < 5; ++i) { - result += texture(Texture, Input.TextureCoordinate + vec2(0.0, tex_offset.y * i)).rgb * weight[i]; - result += texture(Texture, Input.TextureCoordinate - vec2(0.0, tex_offset.y * i)).rgb * weight[i]; + result += textureLod(Texture, Input.TextureCoordinate + vec2(0.0, tex_offset.y * i), MipMapLevel).rgb * weight[i]; + result += textureLod(Texture, Input.TextureCoordinate - vec2(0.0, tex_offset.y * i), MipMapLevel).rgb * weight[i]; + //result += texture(Texture, Input.TextureCoordinate + vec2(0.0, tex_offset.y * i)).rgb * weight[i]; + //result += texture(Texture, Input.TextureCoordinate - vec2(0.0, tex_offset.y * i)).rgb * weight[i]; } fragmentColor = vec4(result, 1.0); } \ No newline at end of file diff --git a/resources/Shaders/TextureCombine.frag.glsl b/resources/Shaders/TextureCombine.frag.glsl new file mode 100644 index 00000000..df1cdd43 --- /dev/null +++ b/resources/Shaders/TextureCombine.frag.glsl @@ -0,0 +1,21 @@ +#version 430 + +layout (binding = 0) uniform sampler2D Texture0; +layout (binding = 1) uniform sampler2D Texture1; + +in VertexData{ + vec2 TextureCoordinate; +}Input; + +out vec4 fragmentColor; + +void main() +{ + vec4 texel0 = texture(Texture0, Input.TextureCoordinate); + vec4 texel1 = texture(Texture1, Input.TextureCoordinate); + + fragmentColor = texel0 + texel1; + //fragmentColor = vec4(1,0.5,0.7,1); +} + + diff --git a/resources/Shaders/TextureCombine.vert.glsl b/resources/Shaders/TextureCombine.vert.glsl new file mode 100644 index 00000000..346bc141 --- /dev/null +++ b/resources/Shaders/TextureCombine.vert.glsl @@ -0,0 +1,13 @@ +#version 430 + +layout (location = 0) in vec3 Position; + +out VertexData{ + vec2 TextureCoordinate; +}Output; + +void main() +{ + gl_Position = vec4(Position, 1.0); + Output.TextureCoordinate = (vec2(Position) + 1) / 2; +} \ No newline at end of file diff --git a/src/Engine/Rendering/DrawBloomPass.cpp b/src/Engine/Rendering/DrawBloomPass.cpp index 5d8b2359..75939b10 100644 --- a/src/Engine/Rendering/DrawBloomPass.cpp +++ b/src/Engine/Rendering/DrawBloomPass.cpp @@ -6,6 +6,18 @@ DrawBloomPass::DrawBloomPass(IRenderer* renderer) m_ScreenQuad = ResourceManager::Load("Models/Core/ScreenQuad.mesh"); + m_ScreenSizes[0] = 1920.f; + m_ScreenSizes[1] = 1053.f; + m_ScreenSizes[2] = 959.f; + m_ScreenSizes[3] = 525.f; + m_ScreenSizes[4] = 479.f; + m_ScreenSizes[5] = 262.f; + m_ScreenSizes[6] = 239.f; + m_ScreenSizes[7] = 130.f; + m_ScreenSizes[8] = 119.f; + m_ScreenSizes[9] = 64.f; + + InitializeTextures(); InitializeBuffers(); InitializeShaderPrograms(); @@ -18,31 +30,51 @@ void DrawBloomPass::InitializeTextures() void DrawBloomPass::InitializeShaderPrograms() { - m_GaussianProgram_horiz = ResourceManager::Load("##GaussianProgramHoriz"); + m_GaussianProgram_horiz = ResourceManager::Load("#GaussianProgramHoriz"); m_GaussianProgram_horiz->AddShader(std::shared_ptr(new VertexShader("Shaders/Gaussian_horiz.vert.glsl"))); m_GaussianProgram_horiz->AddShader(std::shared_ptr(new FragmentShader("Shaders/Gaussian_horiz.frag.glsl"))); m_GaussianProgram_horiz->Compile(); m_GaussianProgram_horiz->Link(); - m_GaussianProgram_vert = ResourceManager::Load("##GaussianProgramVert"); + m_GaussianProgram_vert = ResourceManager::Load("#GaussianProgramVert"); m_GaussianProgram_vert->AddShader(std::shared_ptr(new VertexShader("Shaders/Gaussian_vert.vert.glsl"))); m_GaussianProgram_vert->AddShader(std::shared_ptr(new FragmentShader("Shaders/Gaussian_vert.frag.glsl"))); m_GaussianProgram_vert->Compile(); m_GaussianProgram_vert->Link(); + + m_GaussianProgram_both = ResourceManager::Load("#GaussianProgramBoth"); + m_GaussianProgram_both->AddShader(std::shared_ptr(new VertexShader("Shaders/Gaussian_both.vert.glsl"))); + m_GaussianProgram_both->AddShader(std::shared_ptr(new FragmentShader("Shaders/Gaussian_both.frag.glsl"))); + m_GaussianProgram_both->Compile(); + m_GaussianProgram_both->Link(); + + m_CombineProgram = ResourceManager::Load("#CombineProgram"); + m_CombineProgram->AddShader(std::shared_ptr(new VertexShader("Shaders/TextureCombine.vert.glsl"))); + m_CombineProgram->AddShader(std::shared_ptr(new FragmentShader("Shaders/TextureCombine.frag.glsl"))); + m_CombineProgram->Compile(); + m_CombineProgram->Link(); + + //Fixa nya combine shadern } void DrawBloomPass::InitializeBuffers() { - GenerateTexture(&m_GaussianTexture_horiz, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT); + GenerateTexture(&m_GaussianTexture_horiz, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_HALF_FLOAT); m_GaussianFrameBuffer_horiz.AddResource(std::shared_ptr(new Texture2D(&m_GaussianTexture_horiz, GL_COLOR_ATTACHMENT0))); m_GaussianFrameBuffer_horiz.Generate(); - GenerateTexture(&m_GaussianTexture_vert, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT); + GenerateTexture(&m_GaussianTexture_vert, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_HALF_FLOAT); m_GaussianFrameBuffer_vert.AddResource(std::shared_ptr(new Texture2D(&m_GaussianTexture_vert, GL_COLOR_ATTACHMENT0))); m_GaussianFrameBuffer_vert.Generate(); + + GenerateTexture(&m_FinalBlurTexture, GL_CLAMP_TO_EDGE, GL_LINEAR, glm::vec2(m_Renderer->GetViewportSize().Width, m_Renderer->GetViewportSize().Height), GL_RGB16F, GL_RGB, GL_FLOAT); + + m_BlurredFinalTexture.AddResource(std::shared_ptr(new Texture2D(&m_FinalBlurTexture, GL_COLOR_ATTACHMENT0))); + m_BlurredFinalTexture.Generate(); + } @@ -60,65 +92,123 @@ void DrawBloomPass::ClearBuffer() void DrawBloomPass::Draw(GLuint texture) { - GLERROR("DrawBloomPass::Draw: Pre"); + + ImGui::Combo("DebugBloom", &m_DebugTextureToDraw, "ALL\0First\0SEcond\0Third\0Fourth\0Fifth"); + ImGui::SliderInt("Iterations", &m_Iterations, 0, 10); + + if (m_DebugTextureToDraw == 1) + BlurOneMipMapLevel(&texture, m_Iterations, 0); + else if (m_DebugTextureToDraw == 2) + BlurOneMipMapLevel(&texture, m_Iterations, 1); + else if (m_DebugTextureToDraw == 3) + BlurOneMipMapLevel(&texture, m_Iterations, 2); + else if (m_DebugTextureToDraw == 4) + BlurOneMipMapLevel(&texture, m_Iterations, 3); + else if (m_DebugTextureToDraw == 0) { + BlurOneMipMapLevel(&texture, m_Iterations, 0); + BlurOneMipMapLevel(&texture, m_Iterations, 1); + BlurOneMipMapLevel(&texture, m_Iterations, 2); + BlurOneMipMapLevel(&texture, m_Iterations, 3); + } + +} + +void DrawBloomPass::BlurOneMipMapLevel(GLuint* texture, GLint iterations, GLint mipMapLevel) +{ + GLERROR("PRE"); + + //new code DrawBloomPassState state; - + //Loop through and blur texture at mipmap level GLuint shaderHandle_horiz = m_GaussianProgram_horiz->GetHandle(); GLuint shaderHandle_vert = m_GaussianProgram_vert->GetHandle(); - //Horizontal pass, first use the given texture then save it to the horizontal framebuffer. + //First horiz pass m_GaussianFrameBuffer_horiz.Bind(); m_GaussianProgram_horiz->Bind(); + GLERROR("Bind"); + + + glUniform1i(glGetUniformLocation(shaderHandle_horiz, "MipMapLevel"), mipMapLevel); + //glUniform2fv(glGetUniformLocation(m_GaussianProgram_both->GetHandle(), "ScreenSize"), 5, m_ScreenSizes); + //glUniform1i(glGetUniformLocation(m_GaussianProgram_both->GetHandle(), "Horizontal"), true); + GLERROR("1"); glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, texture); + glBindTexture(GL_TEXTURE_2D, *texture); + glBindVertexArray(m_ScreenQuad->VAO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer); glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].EndIndex - m_ScreenQuad->MaterialGroups()[0].StartIndex +1 , GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].StartIndex); + GLERROR("2"); - //Iterate some times to make it more gaussian. - for (int i = 1; i < m_iterations; i++) { + + //Loop through vert, then horiz and save to respective textures X number of times. + for (int i = 1; i < iterations; i++) { //Vertical pass m_GaussianFrameBuffer_vert.Bind(); m_GaussianProgram_vert->Bind(); + //glUniform1i(glGetUniformLocation(m_GaussianProgram_both->GetHandle(), "Horizontal"), false); + glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_horiz); glBindVertexArray(m_ScreenQuad->VAO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer); glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].EndIndex - m_ScreenQuad->MaterialGroups()[0].StartIndex +1 , GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].StartIndex); + GLERROR("3"); //horizontal pass m_GaussianFrameBuffer_horiz.Bind(); m_GaussianProgram_horiz->Bind(); + //glUniform1i(glGetUniformLocation(m_GaussianProgram_both->GetHandle(), "Horizontal"), true); + glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_vert); glBindVertexArray(m_ScreenQuad->VAO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer); glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].EndIndex - m_ScreenQuad->MaterialGroups()[0].StartIndex +1 , GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].StartIndex); + GLERROR("4"); + } - //final vertical gaussian after the iterations are done - + //the final vertical iteration. m_GaussianFrameBuffer_vert.Bind(); m_GaussianProgram_vert->Bind(); + //glUniform1i(glGetUniformLocation(m_GaussianProgram_both->GetHandle(), "Horizontal"), false); + glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_horiz); glBindVertexArray(m_ScreenQuad->VAO); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer); glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].EndIndex - m_ScreenQuad->MaterialGroups()[0].StartIndex +1 , GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].StartIndex); + GLERROR("5"); - GLERROR("DrawBloomPass::Draw: END"); + //Combine the the new blurred texture into the final texture + m_BlurredFinalTexture.Bind(); + m_CombineProgram->Bind(); + + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, m_FinalBlurTexture); + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, m_GaussianTexture_vert); + + glBindVertexArray(m_ScreenQuad->VAO); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_ScreenQuad->ElementBuffer); + glDrawElementsBaseVertex(GL_TRIANGLES, m_ScreenQuad->MaterialGroups()[0].EndIndex - m_ScreenQuad->MaterialGroups()[0].StartIndex +1 + , GL_UNSIGNED_INT, 0, m_ScreenQuad->MaterialGroups()[0].StartIndex); + + GLERROR("END"); } void DrawBloomPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type) const @@ -132,3 +222,5 @@ void DrawBloomPass::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum fil glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, dimensions.x, dimensions.y, 0, format, type, nullptr);//TODO: Renderer: Fix the precision and Resolution GLERROR("Texture initialization failed"); } + + diff --git a/src/Engine/Rendering/DrawFinalPass.cpp b/src/Engine/Rendering/DrawFinalPass.cpp index 6309a082..e51fd898 100644 --- a/src/Engine/Rendering/DrawFinalPass.cpp +++ b/src/Engine/Rendering/DrawFinalPass.cpp @@ -216,11 +216,11 @@ void DrawFinalPass::GenerateMipMapTexture(GLuint* texture, GLenum wrapping, glm: glGenTextures(1, texture); glBindTexture(GL_TEXTURE_2D, *texture); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dimensions.x, dimensions.y, 0, format, type, nullptr);//TODO: Renderer: Fix the precision and Resolution glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrapping); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrapping); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR_MIPMAP_LINEAR); //TODO: THIS SHIS IS BROKEN WHY YOU NO LINEAR MIPMAP? SHITTY FUCK - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dimensions.x, dimensions.y, 0, format, type, nullptr);//TODO: Renderer: Fix the precision and Resolution + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); //TODO: THIS SHIS IS BROKEN WHY YOU NO LINEAR MIPMAP? SHITTY FUCK glGenerateMipmap(GL_TEXTURE_2D); GLERROR("MipMap Texture initialization failed"); @@ -324,6 +324,9 @@ void DrawFinalPass::DrawModelRenderQueues(std::list>& } } } + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, m_BloomTexture); + glGenerateMipmap(GL_TEXTURE_2D); }