diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-06-10 21:10:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-06-10 21:10:09 +0300 |
commit | 960d6010125af65db183c3998d890299c577f326 (patch) | |
tree | 5d336e281737e10503de35e7aa1dab872e99f2f9 /src | |
parent | 0ae3fbab8d27f46d618a4cfe738c73c70bc3a57e (diff) | |
download | manaplus-960d6010125af65db183c3998d890299c577f326.tar.gz manaplus-960d6010125af65db183c3998d890299c577f326.tar.bz2 manaplus-960d6010125af65db183c3998d890299c577f326.tar.xz manaplus-960d6010125af65db183c3998d890299c577f326.zip |
In modernopengl dont set color if it already same.
Diffstat (limited to 'src')
-rw-r--r-- | src/render/modernopenglgraphics.cpp | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/render/modernopenglgraphics.cpp b/src/render/modernopenglgraphics.cpp index 3f6c3595b..c4d6e8ec9 100644 --- a/src/render/modernopenglgraphics.cpp +++ b/src/render/modernopenglgraphics.cpp @@ -188,25 +188,28 @@ void ModernOpenGLGraphics::setColor(const Color &color) void ModernOpenGLGraphics::setColorAll(const Color &color, const Color &color2) { - mColor = color; mColor2 = color2; mColorAlpha = (color.a != 255); - if (mTextureDraw) + if (mColor != color) { - mglProgramUniform4f(mSimpleProgramId, - mSimpleColorUniform, - static_cast<float>(color.r) / 255.0F, - static_cast<float>(color.g) / 255.0F, - static_cast<float>(color.b) / 255.0F, - static_cast<float>(color.a) / 255.0F); - } - else - { - mglUniform4f(mSimpleColorUniform, - static_cast<float>(color.r) / 255.0F, - static_cast<float>(color.g) / 255.0F, - static_cast<float>(color.b) / 255.0F, - static_cast<float>(color.a) / 255.0F); + mColor = color; + if (mTextureDraw) + { + mglProgramUniform4f(mSimpleProgramId, + mSimpleColorUniform, + static_cast<float>(color.r) / 255.0F, + static_cast<float>(color.g) / 255.0F, + static_cast<float>(color.b) / 255.0F, + static_cast<float>(color.a) / 255.0F); + } + else + { + mglUniform4f(mSimpleColorUniform, + static_cast<float>(color.r) / 255.0F, + static_cast<float>(color.g) / 255.0F, + static_cast<float>(color.b) / 255.0F, + static_cast<float>(color.a) / 255.0F); + } } } |