Set Color as a uniform

icc-effect-5.14.5
Martin Gräßlin 2010-12-11 11:10:33 +01:00
parent d2cfeef8ae
commit 753df55973
2 changed files with 10 additions and 0 deletions

View File

@ -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);

View File

@ -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);
/**