diff --git a/lib/kwinglutils.cpp b/lib/kwinglutils.cpp index 50593af815..eca93a789e 100644 --- a/lib/kwinglutils.cpp +++ b/lib/kwinglutils.cpp @@ -1040,6 +1040,15 @@ bool GLShader::setUniform(const char* name, const QMatrix4x4& value) return (location >= 0); } +bool GLShader::setUniform(const char* name, const QColor& color) +{ + const int location = uniformLocation(name); + if (location >= 0) { + glUniform4f(location, color.redF(), color.greenF(), color.blueF(), color.alphaF()); + } + return (location >= 0); +} + int GLShader::attributeLocation(const char* name) { int location = glGetAttribLocation(mProgram, name); diff --git a/lib/kwinglutils.h b/lib/kwinglutils.h index cc928848d0..8ff045b71d 100644 --- a/lib/kwinglutils.h +++ b/lib/kwinglutils.h @@ -258,6 +258,7 @@ class KWIN_EXPORT GLShader bool setUniform(const char* name, const QVector3D& value); bool setUniform(const char* name, const QVector4D& value); bool setUniform(const char* name, const QMatrix4x4& value); + bool setUniform(const char* name, const QColor& color); int attributeLocation(const char* name); bool setAttribute(const char* name, float value); /**