summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-10 21:10:09 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-10 21:10:09 +0300
commit960d6010125af65db183c3998d890299c577f326 (patch)
tree5d336e281737e10503de35e7aa1dab872e99f2f9
parent0ae3fbab8d27f46d618a4cfe738c73c70bc3a57e (diff)
downloadmv-960d6010125af65db183c3998d890299c577f326.tar.gz
mv-960d6010125af65db183c3998d890299c577f326.tar.bz2
mv-960d6010125af65db183c3998d890299c577f326.tar.xz
mv-960d6010125af65db183c3998d890299c577f326.zip
In modernopengl dont set color if it already same.
-rw-r--r--src/render/modernopenglgraphics.cpp35
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);
+ }
}
}