1 From 2b4d3391fd922dfc5ac28815bbd5f36c4041b658 Mon Sep 17 00:00:00 2001
2 From: Tom Cooksey <thomas.cooksey@nokia.com>
3 Date: Mon, 21 Dec 2009 16:36:14 +0100
4 Subject: [PATCH 1197/1244] Add GLfloat[2][2] & GLfloat[3][3] uniform setters to QGLShaderProgram
6 Reviewed-By: Rhys Weatherley
8 src/opengl/qglshaderprogram.cpp | 67 +++++++++++++++++++++++++++++++++++++++
9 src/opengl/qglshaderprogram.h | 4 ++
10 2 files changed, 71 insertions(+), 0 deletions(-)
12 diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
13 index b4191dc..f9737a5 100644
14 --- a/src/opengl/qglshaderprogram.cpp
15 +++ b/src/opengl/qglshaderprogram.cpp
16 @@ -2275,6 +2275,42 @@ void QGLShaderProgram::setUniformValue(const char *name, const QMatrix4x4& value
19 Sets the uniform variable at \a location in the current context
20 + to a 2x2 matrix \a value. The matrix elements must be specified
21 + in column-major order.
23 + \sa setAttributeValue()
26 +void QGLShaderProgram::setUniformValue(int location, const GLfloat value[2][2])
28 + Q_D(QGLShaderProgram);
31 + glUniformMatrix2fv(location, 1, GL_FALSE, value[0]);
37 + Sets the uniform variable at \a location in the current context
38 + to a 3x3 matrix \a value. The matrix elements must be specified
39 + in column-major order.
41 + \sa setAttributeValue()
44 +void QGLShaderProgram::setUniformValue(int location, const GLfloat value[3][3])
46 + Q_D(QGLShaderProgram);
49 + glUniformMatrix3fv(location, 1, GL_FALSE, value[0]);
55 + Sets the uniform variable at \a location in the current context
56 to a 4x4 matrix \a value. The matrix elements must be specified
57 in column-major order.
59 @@ -2288,6 +2324,37 @@ void QGLShaderProgram::setUniformValue(int location, const GLfloat value[4][4])
60 glUniformMatrix4fv(location, 1, GL_FALSE, value[0]);
67 + Sets the uniform variable called \a name in the current context
68 + to a 2x2 matrix \a value. The matrix elements must be specified
69 + in column-major order.
71 + \sa setAttributeValue()
74 +void QGLShaderProgram::setUniformValue(const char *name, const GLfloat value[2][2])
76 + setUniformValue(uniformLocation(name), value);
82 + Sets the uniform variable called \a name in the current context
83 + to a 3x3 matrix \a value. The matrix elements must be specified
84 + in column-major order.
86 + \sa setAttributeValue()
89 +void QGLShaderProgram::setUniformValue(const char *name, const GLfloat value[3][3])
91 + setUniformValue(uniformLocation(name), value);
97 diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h
98 index deeaee2..4eb80dd 100644
99 --- a/src/opengl/qglshaderprogram.h
100 +++ b/src/opengl/qglshaderprogram.h
101 @@ -216,6 +216,8 @@ public:
102 void setUniformValue(int location, const QMatrix4x2& value);
103 void setUniformValue(int location, const QMatrix4x3& value);
104 void setUniformValue(int location, const QMatrix4x4& value);
105 + void setUniformValue(int location, const GLfloat value[2][2]);
106 + void setUniformValue(int location, const GLfloat value[3][3]);
107 void setUniformValue(int location, const GLfloat value[4][4]);
108 void setUniformValue(int location, const QTransform& value);
110 @@ -242,6 +244,8 @@ public:
111 void setUniformValue(const char *name, const QMatrix4x2& value);
112 void setUniformValue(const char *name, const QMatrix4x3& value);
113 void setUniformValue(const char *name, const QMatrix4x4& value);
114 + void setUniformValue(const char *name, const GLfloat value[2][2]);
115 + void setUniformValue(const char *name, const GLfloat value[3][3]);
116 void setUniformValue(const char *name, const GLfloat value[4][4]);
117 void setUniformValue(const char *name, const QTransform& value);