Set Color as a uniform
This commit is contained in:
parent
d2cfeef8ae
commit
753df55973
2 changed files with 10 additions and 0 deletions
|
@ -1040,6 +1040,15 @@ bool GLShader::setUniform(const char* name, const QMatrix4x4& value)
|
||||||
return (location >= 0);
|
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 GLShader::attributeLocation(const char* name)
|
||||||
{
|
{
|
||||||
int location = glGetAttribLocation(mProgram, name);
|
int location = glGetAttribLocation(mProgram, name);
|
||||||
|
|
|
@ -258,6 +258,7 @@ class KWIN_EXPORT GLShader
|
||||||
bool setUniform(const char* name, const QVector3D& value);
|
bool setUniform(const char* name, const QVector3D& value);
|
||||||
bool setUniform(const char* name, const QVector4D& value);
|
bool setUniform(const char* name, const QVector4D& value);
|
||||||
bool setUniform(const char* name, const QMatrix4x4& value);
|
bool setUniform(const char* name, const QMatrix4x4& value);
|
||||||
|
bool setUniform(const char* name, const QColor& color);
|
||||||
int attributeLocation(const char* name);
|
int attributeLocation(const char* name);
|
||||||
bool setAttribute(const char* name, float value);
|
bool setAttribute(const char* name, float value);
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue