summaryrefslogtreecommitdiff
path: root/src/render/mobileopengl2graphics.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-12-11 01:55:33 +0300
committerAndrei Karas <akaras@inbox.ru>2015-12-11 02:22:49 +0300
commit59ab65919f9292b9aa324d1406033786c34cf4ce (patch)
treefdbf4089d43ab8070cb302edf69c3bc8874815be /src/render/mobileopengl2graphics.cpp
parent5e460c2c47e85a5ec70e0979750170ec6cd199b3 (diff)
downloadplus-59ab65919f9292b9aa324d1406033786c34cf4ce.tar.gz
plus-59ab65919f9292b9aa324d1406033786c34cf4ce.tar.bz2
plus-59ab65919f9292b9aa324d1406033786c34cf4ce.tar.xz
plus-59ab65919f9292b9aa324d1406033786c34cf4ce.zip
In mobileopengl2graphics update texture size uniform only if size changed.
Diffstat (limited to 'src/render/mobileopengl2graphics.cpp')
-rw-r--r--src/render/mobileopengl2graphics.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/render/mobileopengl2graphics.cpp b/src/render/mobileopengl2graphics.cpp
index 668734845..8e34cbbe5 100644
--- a/src/render/mobileopengl2graphics.cpp
+++ b/src/render/mobileopengl2graphics.cpp
@@ -77,6 +77,8 @@
GLuint MobileOpenGL2Graphics::mTextureBinded = 0U;
GLuint MobileOpenGL2Graphics::mTextureSizeUniform = 0U;
+int MobileOpenGL2Graphics::mTextureWidth = 1;
+int MobileOpenGL2Graphics::mTextureHeight = 1;
#ifdef DEBUG_DRAW_CALLS
unsigned int MobileOpenGL2Graphics::mDrawCalls = 0U;
unsigned int MobileOpenGL2Graphics::mLastDrawCalls = 0U;
@@ -1118,10 +1120,15 @@ void MobileOpenGL2Graphics::bindTexture2(const GLenum target,
{
mTextureBinded = texture;
glBindTexture(target, texture);
- // need check sizes before update uniform
- mglUniform2f(mTextureSizeUniform,
- image->mTexWidth,
- image->mTexHeight);
+ if (mTextureWidth != image->mTexWidth ||
+ mTextureHeight != image->mTexHeight)
+ {
+ mTextureWidth = image->mTexWidth;
+ mTextureHeight = image->mTexHeight;
+ mglUniform2f(mTextureSizeUniform,
+ image->mTexWidth,
+ image->mTexHeight);
+ }
}
}