Set Color as a uniform

This commit is contained in:
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);
/**