summaryrefslogtreecommitdiff
path: root/src/resources/openglimagehelper.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-01 23:32:51 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-01 23:45:06 +0300
commit7fa069aec585316c34ada298ec557c7e800bf8f3 (patch)
tree64cb7078677a695eb9cc429e4546114d06ff6d37 /src/resources/openglimagehelper.cpp
parentc195c960fc2ce7a5a211c26310ae98bfe39ab777 (diff)
downloadplus-7fa069aec585316c34ada298ec557c7e800bf8f3.tar.gz
plus-7fa069aec585316c34ada298ec557c7e800bf8f3.tar.bz2
plus-7fa069aec585316c34ada298ec557c7e800bf8f3.tar.xz
plus-7fa069aec585316c34ada298ec557c7e800bf8f3.zip
Using GL_ARB_sampler_objects.
Diffstat (limited to 'src/resources/openglimagehelper.cpp')
-rw-r--r--src/resources/openglimagehelper.cpp35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/resources/openglimagehelper.cpp b/src/resources/openglimagehelper.cpp
index 8aed5330e..f1847c150 100644
--- a/src/resources/openglimagehelper.cpp
+++ b/src/resources/openglimagehelper.cpp
@@ -28,6 +28,7 @@
#include "game.h"
#include "graphicsmanager.h"
#include "logger.h"
+#include "mgl.h"
#include "normalopenglgraphics.h"
#include "safeopenglgraphics.h"
@@ -47,6 +48,7 @@ int OpenGLImageHelper::mInternalTextureType = GL_RGBA8;
int OpenGLImageHelper::mTextureSize = 0;
bool OpenGLImageHelper::mBlur = true;
int OpenGLImageHelper::mUseOpenGL = 0;
+bool OpenGLImageHelper::mUseTextureSampler = false;
Image *OpenGLImageHelper::load(SDL_RWops *const rw, Dye const &dye)
{
@@ -222,15 +224,18 @@ Image *OpenGLImageHelper::glLoad(SDL_Surface *tmpImage)
SDL_LockSurface(tmpImage);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- if (mBlur)
+ if (!mUseTextureSampler)
{
- 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);
+ 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, mInternalTextureType,
@@ -300,4 +305,18 @@ int OpenGLImageHelper::useOpenGL()
{
return mUseOpenGL;
}
+
+void OpenGLImageHelper::initTextureSampler(GLint id)
+{
+ if (mBlur)
+ {
+ mglSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ mglSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ }
+ else
+ {
+ mglSamplerParameteri(id, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ mglSamplerParameteri(id, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ }
+}
#endif