Skip to content

Commit

Permalink
UPBGE: Remove bgl_LuminanceTexture.
Browse files Browse the repository at this point in the history
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);
  • Loading branch information
panzergame committed Aug 8, 2016
1 parent 6b47c01 commit 7fba3fd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 25 deletions.
24 changes: 0 additions & 24 deletions source/gameengine/Rasterizer/RAS_2DFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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) {
Expand All @@ -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);
Expand Down
1 change: 0 additions & 1 deletion source/gameengine/Rasterizer/RAS_2DFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7fba3fd

Please sign in to comment.