summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/opengl/qglshaderprogram.cpp132
-rw-r--r--src/opengl/qglshaderprogram.h10
2 files changed, 142 insertions, 0 deletions
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index 5738acd..c2be1be 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -1836,6 +1836,30 @@ void QGLShaderProgram::setUniformValue(const char *name, GLint value)
}
/*!
+ Sets the uniform variable at \a location in the current context to \a value.
+
+ \sa setAttributeValue()
+*/
+void QGLShaderProgram::setUniformValue(int location, GLuint value)
+{
+ if (location != -1)
+ glUniform1i(location, value);
+}
+
+/*!
+ \overload
+
+ Sets the uniform variable called \a name in the current context
+ to \a value.
+
+ \sa setAttributeValue()
+*/
+void QGLShaderProgram::setUniformValue(const char *name, GLuint value)
+{
+ setUniformValue(uniformLocation(name), value);
+}
+
+/*!
Sets the uniform variable at \a location in the current context to
the 2D vector (\a x, \a y).
@@ -2020,6 +2044,114 @@ void QGLShaderProgram::setUniformValue(const char *name, const QColor& color)
}
/*!
+ Sets the uniform variable at \a location in the current context to
+ the x() & y() coordinates of \a point.
+
+ \sa setAttributeValue()
+*/
+void QGLShaderProgram::setUniformValue(int location, const QPoint& point)
+{
+ if (location != -1) {
+ GLfloat values[4] = {point.x(), point.y()};
+ glUniform2fv(location, 1, values);
+ }
+}
+
+/*!
+ \overload
+
+ Sets the uniform variable at \a location in the current context to
+ the x() & y() coordinates of \a point.
+
+ \sa setAttributeValue()
+*/
+void QGLShaderProgram::setUniformValue(const char *name, const QPoint& point)
+{
+ setUniformValue(uniformLocation(name), point);
+}
+
+/*!
+ Sets the uniform variable at \a location in the current context to
+ the x() & y() coordinates of \a point.
+
+ \sa setAttributeValue()
+*/
+void QGLShaderProgram::setUniformValue(int location, const QPointF& point)
+{
+ if (location != -1) {
+ GLfloat values[4] = {point.x(), point.y()};
+ glUniform2fv(location, 1, values);
+ }
+}
+
+/*!
+ \overload
+
+ Sets the uniform variable at \a location in the current context to
+ the x() & y() coordinates of \a point.
+
+ \sa setAttributeValue()
+*/
+void QGLShaderProgram::setUniformValue(const char *name, const QPointF& point)
+{
+ setUniformValue(uniformLocation(name), point);
+}
+
+/*!
+ Sets the uniform variable at \a location in the current context to
+ the width() & height() of the given \a size.
+
+ \sa setAttributeValue()
+*/
+void QGLShaderProgram::setUniformValue(int location, const QSize& size)
+{
+ if (location != -1) {
+ GLfloat values[4] = {size.width(), size.width()};
+ glUniform2fv(location, 1, values);
+ }
+}
+
+/*!
+ \overload
+
+ Sets the uniform variable at \a location in the current context to
+ the width() & height() of the given \a size.
+
+ \sa setAttributeValue()
+*/
+void QGLShaderProgram::setUniformValue(const char *name, const QSize& size)
+{
+ setUniformValue(uniformLocation(name), size);
+}
+
+/*!
+ Sets the uniform variable at \a location in the current context to
+ the width() & height() of the given \a size.
+
+ \sa setAttributeValue()
+*/
+void QGLShaderProgram::setUniformValue(int location, const QSizeF& size)
+{
+ if (location != -1) {
+ GLfloat values[4] = {size.width(), size.height()};
+ glUniform2fv(location, 1, values);
+ }
+}
+
+/*!
+ \overload
+
+ Sets the uniform variable at \a location in the current context to
+ the width() & height() of the given \a size.
+
+ \sa setAttributeValue()
+*/
+void QGLShaderProgram::setUniformValue(const char *name, const QSizeF& size)
+{
+ setUniformValue(uniformLocation(name), size);
+}
+
+/*!
Sets the uniform variable at \a location in the current context
to a 2x2 matrix \a value.
diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h
index ec6faaf..508fd96 100644
--- a/src/opengl/qglshaderprogram.h
+++ b/src/opengl/qglshaderprogram.h
@@ -196,6 +196,7 @@ public:
void setUniformValue(int location, GLfloat value);
void setUniformValue(int location, GLint value);
+ void setUniformValue(int location, GLuint value);
void setUniformValue(int location, GLfloat x, GLfloat y);
void setUniformValue(int location, GLfloat x, GLfloat y, GLfloat z);
void setUniformValue(int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
@@ -203,6 +204,10 @@ public:
void setUniformValue(int location, const QVector3D& value);
void setUniformValue(int location, const QVector4D& value);
void setUniformValue(int location, const QColor& color);
+ void setUniformValue(int location, const QPoint& point);
+ void setUniformValue(int location, const QPointF& point);
+ void setUniformValue(int location, const QSize& size);
+ void setUniformValue(int location, const QSizeF& size);
void setUniformValue(int location, const QMatrix2x2& value);
void setUniformValue(int location, const QMatrix2x3& value);
void setUniformValue(int location, const QMatrix2x4& value);
@@ -217,6 +222,7 @@ public:
void setUniformValue(const char *name, GLfloat value);
void setUniformValue(const char *name, GLint value);
+ void setUniformValue(const char *name, GLuint value);
void setUniformValue(const char *name, GLfloat x, GLfloat y);
void setUniformValue(const char *name, GLfloat x, GLfloat y, GLfloat z);
void setUniformValue(const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
@@ -224,6 +230,10 @@ public:
void setUniformValue(const char *name, const QVector3D& value);
void setUniformValue(const char *name, const QVector4D& value);
void setUniformValue(const char *name, const QColor& color);
+ void setUniformValue(const char *name, const QPoint& point);
+ void setUniformValue(const char *name, const QPointF& point);
+ void setUniformValue(const char *name, const QSize& size);
+ void setUniformValue(const char *name, const QSizeF& size);
void setUniformValue(const char *name, const QMatrix2x2& value);
void setUniformValue(const char *name, const QMatrix2x3& value);
void setUniformValue(const char *name, const QMatrix2x4& value);