From 4f73caba4497344c50ea245673493941d277699f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 7 Apr 2012 20:04:31 +0300 Subject: Add option to enable/disable texture blurring. (GL_LINEAR/GL_LINEAR) --- src/defaults.cpp | 1 + src/gui/setup_visual.cpp | 3 +++ src/resources/image.cpp | 13 +++++++++++-- src/resources/image.h | 4 ++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/defaults.cpp b/src/defaults.cpp index 0b9e68092..f29d304da 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -243,6 +243,7 @@ DefaultsData* getConfigDefaults() AddDEF(configData, "autohideChat", false); AddDEF(configData, "downloadProxy", ""); AddDEF(configData, "downloadProxyType", 0); + AddDEF(configData, "blur", true); return configData; } diff --git a/src/gui/setup_visual.cpp b/src/gui/setup_visual.cpp index 5a7ddc5ec..368ceeee8 100644 --- a/src/gui/setup_visual.cpp +++ b/src/gui/setup_visual.cpp @@ -53,6 +53,9 @@ Setup_Visual::Setup_Visual() new SetupItemCheckBox(_("Grab mouse and keyboard input"), "", "grabinput", this, "grabinputEvent"); + new SetupItemCheckBox(_("Blurring textures (OpenGL)"), + "", "blur", this, "blurEvent"); + new SetupItemSlider(_("Gui opacity"), "", "guialpha", this, "guialphaEvent", 0.1, 1.0, 150, true); diff --git a/src/resources/image.cpp b/src/resources/image.cpp index c63fcab99..54a969d57 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -45,6 +45,7 @@ int Image::mUseOpenGL = 0; int Image::mTextureType = 0; int Image::mTextureSize = 0; +bool Image::mBlur = true; #endif bool Image::mEnableAlphaCache = false; bool Image::mEnableAlpha = true; @@ -766,8 +767,16 @@ Image *Image::_GLload(SDL_Surface *tmpImage) SDL_LockSurface(tmpImage); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glTexParameteri(mTextureType, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(mTextureType, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + if (mBlur) + { + glTexParameteri(mTextureType, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(mTextureType, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } + else + { + glTexParameteri(mTextureType, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(mTextureType, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } glTexImage2D(mTextureType, 0, 4, tmpImage->w, tmpImage->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, tmpImage->pixels); diff --git a/src/resources/image.h b/src/resources/image.h index 89fe24d89..17eb3ec93 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -215,6 +215,9 @@ class Image : public Resource static int getTextureType() { return mTextureType; } + static void setBlur(bool n) + { mBlur = n; } + static int mTextureType; #endif @@ -294,6 +297,7 @@ class Image : public Resource static int mUseOpenGL; static int mTextureSize; + static bool mBlur; #endif }; -- cgit v1.2.3-70-g09d2