src/opengl/qglshaderprogram.cpp
changeset 22 79de32ba3296
parent 18 2f34d5167611
child 30 5dc02b23752f
--- a/src/opengl/qglshaderprogram.cpp	Mon May 03 13:17:34 2010 +0300
+++ b/src/opengl/qglshaderprogram.cpp	Fri May 14 16:40:13 2010 +0300
@@ -969,17 +969,18 @@
     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 @@
     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 @@
     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)