summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorRhys Weatherley <rhys.weatherley@nokia.com>2010-03-31 01:41:07 (GMT)
committerRhys Weatherley <rhys.weatherley@nokia.com>2010-03-31 01:41:07 (GMT)
commit88eb3b1670ac3989e6549bd8870f482ce357c979 (patch)
tree774ee0134e99fc48af36431a2bbd9a20fedaddb9 /src/opengl
parent0d41d766d13bc6ee8a068aef4b88567c111d0e0c (diff)
downloadQt-88eb3b1670ac3989e6549bd8870f482ce357c979.zip
Qt-88eb3b1670ac3989e6549bd8870f482ce357c979.tar.gz
Qt-88eb3b1670ac3989e6549bd8870f482ce357c979.tar.bz2
Allow attributes to be bound after a QGLShaderProgram is linked.
Task-number: QTBUG-9450 Reviewed-by: Sarah Smith
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qglshaderprogram.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index 79484fa..bbfc2d5 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -969,17 +969,18 @@ GLuint QGLShaderProgram::programId() const
Any attributes that have not been explicitly bound when the program
is linked will be assigned locations automatically.
+ When this function is called after the program has been linked,
+ the program will need to be relinked for the change to take effect.
+
\sa attributeLocation()
*/
void QGLShaderProgram::bindAttributeLocation(const char *name, int location)
{
Q_D(QGLShaderProgram);
- if (!d->linked) {
- glBindAttribLocation(d->programGuard.id(), location, name);
- } else {
- qWarning() << "QGLShaderProgram::bindAttributeLocation(" << name
- << "): cannot bind after shader program is linked";
- }
+ if (!init())
+ return;
+ glBindAttribLocation(d->programGuard.id(), location, name);
+ d->linked = false; // Program needs to be relinked.
}
/*!
@@ -990,6 +991,9 @@ void QGLShaderProgram::bindAttributeLocation(const char *name, int location)
Any attributes that have not been explicitly bound when the program
is linked will be assigned locations automatically.
+ When this function is called after the program has been linked,
+ the program will need to be relinked for the change to take effect.
+
\sa attributeLocation()
*/
void QGLShaderProgram::bindAttributeLocation(const QByteArray& name, int location)
@@ -1005,6 +1009,9 @@ void QGLShaderProgram::bindAttributeLocation(const QByteArray& name, int locatio
Any attributes that have not been explicitly bound when the program
is linked will be assigned locations automatically.
+ When this function is called after the program has been linked,
+ the program will need to be relinked for the change to take effect.
+
\sa attributeLocation()
*/
void QGLShaderProgram::bindAttributeLocation(const QString& name, int location)