From 7fba3fd35704b1d7b7a9d110c7fcd6d87345b596 Mon Sep 17 00:00:00 2001 From: Porteries Tristan Date: Sun, 7 Aug 2016 20:03:53 +0000 Subject: [PATCH] UPBGE: Remove bgl_LuminanceTexture. This texture use a deprecated format and only correspond to the red channel of bgl_RenderedTexture. After all we found no 2d filter shader using it at the moment. This texture and uniform is then removed, but the user can replace: vec4 luminance = texture2D(bgl_LuminanceTexture, co); by: vec4 luminance = vec4(vec3(texture2D(bgl_RenderedTexture, co).r), 1.0); --- source/gameengine/Rasterizer/RAS_2DFilter.cpp | 24 ------------------- source/gameengine/Rasterizer/RAS_2DFilter.h | 1 - 2 files changed, 25 deletions(-) diff --git a/source/gameengine/Rasterizer/RAS_2DFilter.cpp b/source/gameengine/Rasterizer/RAS_2DFilter.cpp index db42e0d28ed3..25bcacdc9e3f 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilter.cpp +++ b/source/gameengine/Rasterizer/RAS_2DFilter.cpp @@ -36,7 +36,6 @@ static char predefinedUniformsName[RAS_2DFilter::MAX_PREDEFINED_UNIFORM_TYPE][40] = { "bgl_RenderedTexture", // RENDERED_TEXTURE_UNIFORM - "bgl_LuminanceTexture", // LUMINANCE_TEXTURE_UNIFORM "bgl_DepthTexture", // DEPTH_TEXTURE_UNIFORM "bgl_RenderedTextureWidth", // RENDERED_TEXTURE_WIDTH_UNIFORM "bgl_RenderedTextureHeight", // RENDERED_TEXTURE_HEIGHT_UNIFORM @@ -180,15 +179,6 @@ void RAS_2DFilter::InitializeTextures(RAS_ICanvas *canvas) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); } - if (m_predefinedUniforms[LUMINANCE_TEXTURE_UNIFORM] != -1) { - glGenTextures(1, &m_renderedTextures[LUMINANCE_TEXTURE]); - glBindTexture(GL_TEXTURE_2D, m_renderedTextures[LUMINANCE_TEXTURE]); - glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE16, texturewidth, textureheight, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, 0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - } } /* Fill the textureOffsets array with values used by the shaders to get texture samples @@ -227,12 +217,6 @@ void RAS_2DFilter::BindTextures(RAS_ICanvas *canvas) glBindTexture(GL_TEXTURE_2D, m_renderedTextures[DEPTH_TEXTURE]); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, textureleft, texturebottom, (GLuint)texturewidth, (GLuint)textureheight, 0); } - if (m_predefinedUniforms[LUMINANCE_TEXTURE_UNIFORM] != -1) { - // Create and bind luminance texture. - glActiveTextureARB(GL_TEXTURE10); - glBindTexture(GL_TEXTURE_2D, m_renderedTextures[LUMINANCE_TEXTURE]); - glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE16, textureleft, texturebottom, (GLuint)texturewidth, (GLuint)textureheight, 0); - } // Bind custom textures. for (unsigned short i = 0; i < 8; ++i) { @@ -255,11 +239,6 @@ void RAS_2DFilter::UnbindTextures() glActiveTextureARB(GL_TEXTURE9); glBindTexture(GL_TEXTURE_2D, 0); } - if (m_predefinedUniforms[LUMINANCE_TEXTURE_UNIFORM] != -1) { - // Create and bind luminance texture. - glActiveTextureARB(GL_TEXTURE10); - glBindTexture(GL_TEXTURE_2D, 0); - } // Bind custom textures. for (unsigned short i = 0; i < 8; ++i) { @@ -283,9 +262,6 @@ void RAS_2DFilter::BindUniforms(RAS_ICanvas *canvas) if (m_predefinedUniforms[DEPTH_TEXTURE_UNIFORM] != -1) { SetUniform(m_predefinedUniforms[DEPTH_TEXTURE_UNIFORM], 9); } - if (m_predefinedUniforms[LUMINANCE_TEXTURE_UNIFORM] != -1) { - SetUniform(m_predefinedUniforms[LUMINANCE_TEXTURE_UNIFORM], 10); - } if (m_predefinedUniforms[RENDERED_TEXTURE_WIDTH_UNIFORM] != -1) { // Bind rendered texture width. SetUniform(m_predefinedUniforms[RENDERED_TEXTURE_WIDTH_UNIFORM], (float)texturewidth); diff --git a/source/gameengine/Rasterizer/RAS_2DFilter.h b/source/gameengine/Rasterizer/RAS_2DFilter.h index b58ec805485a..f6995e8ee81f 100644 --- a/source/gameengine/Rasterizer/RAS_2DFilter.h +++ b/source/gameengine/Rasterizer/RAS_2DFilter.h @@ -36,7 +36,6 @@ class RAS_2DFilter : public virtual RAS_Shader public: enum PredefinedUniformType { RENDERED_TEXTURE_UNIFORM = 0, - LUMINANCE_TEXTURE_UNIFORM, DEPTH_TEXTURE_UNIFORM, RENDERED_TEXTURE_WIDTH_UNIFORM, RENDERED_TEXTURE_HEIGHT_UNIFORM,