summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglshaderprogram.cpp
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2009-04-20 23:44:02 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2009-05-01 00:17:46 (GMT)
commit2f60b9688cd48c0cbaaf06862273056ff3710863 (patch)
tree717037de8417e3fedbfc5e2138c30f8470262b0e /src/opengl/qglshaderprogram.cpp
parentab0ee278362ec8bd3acbed0e98b3392aad68bef5 (diff)
downloadQt-2f60b9688cd48c0cbaaf06862273056ff3710863.zip
Qt-2f60b9688cd48c0cbaaf06862273056ff3710863.tar.gz
Qt-2f60b9688cd48c0cbaaf06862273056ff3710863.tar.bz2
Samplers should be set via the GLuint override, not the GLint override.
Reviewed-by: trustme
Diffstat (limited to 'src/opengl/qglshaderprogram.cpp')
-rw-r--r--src/opengl/qglshaderprogram.cpp40
1 files changed, 33 insertions, 7 deletions
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index 55d1bda..ccccc15 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -1818,7 +1818,6 @@ void QGLShaderProgram::setUniformValue(const char *name, GLfloat value)
/*!
Sets the uniform variable at \a location in the current context to \a value.
- This function must be used when setting sampler values.
\sa setAttributeValue()
*/
@@ -1832,7 +1831,7 @@ void QGLShaderProgram::setUniformValue(int location, GLint value)
\overload
Sets the uniform variable called \a name in the current context
- to \a value. This function must be used when setting sampler values.
+ to \a value.
\sa setAttributeValue()
*/
@@ -1843,6 +1842,7 @@ void QGLShaderProgram::setUniformValue(const char *name, GLint value)
/*!
Sets the uniform variable at \a location in the current context to \a value.
+ This function should be used when setting sampler values.
\sa setAttributeValue()
*/
@@ -1856,7 +1856,7 @@ void QGLShaderProgram::setUniformValue(int location, GLuint value)
\overload
Sets the uniform variable called \a name in the current context
- to \a value.
+ to \a value. This function should be used when setting sampler values.
\sa setAttributeValue()
*/
@@ -2519,8 +2519,7 @@ void QGLShaderProgram::setUniformValue
/*!
Sets the uniform variable array at \a location in the current
- context to the \a count elements of \a values. This overload
- must be used when setting an array of sampler values.
+ context to the \a count elements of \a values.
\sa setAttributeValue()
*/
@@ -2534,8 +2533,7 @@ void QGLShaderProgram::setUniformValueArray(int location, const GLint *values, i
\overload
Sets the uniform variable array called \a name in the current
- context to the \a count elements of \a values. This overload
- must be used when setting an array of sampler values.
+ context to the \a count elements of \a values.
\sa setAttributeValue()
*/
@@ -2547,6 +2545,34 @@ void QGLShaderProgram::setUniformValueArray
/*!
Sets the uniform variable array at \a location in the current
+ context to the \a count elements of \a values. This overload
+ should be used when setting an array of sampler values.
+
+ \sa setAttributeValue()
+*/
+void QGLShaderProgram::setUniformValueArray(int location, const GLuint *values, int count)
+{
+ if (location != -1)
+ glUniform1iv(location, count, reinterpret_cast<const GLint *>(values));
+}
+
+/*!
+ \overload
+
+ Sets the uniform variable array called \a name in the current
+ context to the \a count elements of \a values. This overload
+ should be used when setting an array of sampler values.
+
+ \sa setAttributeValue()
+*/
+void QGLShaderProgram::setUniformValueArray
+ (const char *name, const GLuint *values, int count)
+{
+ setUniformValueArray(uniformLocation(name), values, count);
+}
+
+/*!
+ Sets the uniform variable array at \a location in the current
context to the \a count elements of \a values. Each element
has \a size components. The \a size must be 1, 2, 3, or 4.