967 Binds the attribute \a name to the specified \a location. This |
967 Binds the attribute \a name to the specified \a location. This |
968 function can be called before or after the program has been linked. |
968 function can be called before or after the program has been linked. |
969 Any attributes that have not been explicitly bound when the program |
969 Any attributes that have not been explicitly bound when the program |
970 is linked will be assigned locations automatically. |
970 is linked will be assigned locations automatically. |
971 |
971 |
|
972 When this function is called after the program has been linked, |
|
973 the program will need to be relinked for the change to take effect. |
|
974 |
972 \sa attributeLocation() |
975 \sa attributeLocation() |
973 */ |
976 */ |
974 void QGLShaderProgram::bindAttributeLocation(const char *name, int location) |
977 void QGLShaderProgram::bindAttributeLocation(const char *name, int location) |
975 { |
978 { |
976 Q_D(QGLShaderProgram); |
979 Q_D(QGLShaderProgram); |
977 if (!d->linked) { |
980 if (!init()) |
978 glBindAttribLocation(d->programGuard.id(), location, name); |
981 return; |
979 } else { |
982 glBindAttribLocation(d->programGuard.id(), location, name); |
980 qWarning() << "QGLShaderProgram::bindAttributeLocation(" << name |
983 d->linked = false; // Program needs to be relinked. |
981 << "): cannot bind after shader program is linked"; |
|
982 } |
|
983 } |
984 } |
984 |
985 |
985 /*! |
986 /*! |
986 \overload |
987 \overload |
987 |
988 |
988 Binds the attribute \a name to the specified \a location. This |
989 Binds the attribute \a name to the specified \a location. This |
989 function can be called before or after the program has been linked. |
990 function can be called before or after the program has been linked. |
990 Any attributes that have not been explicitly bound when the program |
991 Any attributes that have not been explicitly bound when the program |
991 is linked will be assigned locations automatically. |
992 is linked will be assigned locations automatically. |
992 |
993 |
|
994 When this function is called after the program has been linked, |
|
995 the program will need to be relinked for the change to take effect. |
|
996 |
993 \sa attributeLocation() |
997 \sa attributeLocation() |
994 */ |
998 */ |
995 void QGLShaderProgram::bindAttributeLocation(const QByteArray& name, int location) |
999 void QGLShaderProgram::bindAttributeLocation(const QByteArray& name, int location) |
996 { |
1000 { |
997 bindAttributeLocation(name.constData(), location); |
1001 bindAttributeLocation(name.constData(), location); |
1002 |
1006 |
1003 Binds the attribute \a name to the specified \a location. This |
1007 Binds the attribute \a name to the specified \a location. This |
1004 function can be called before or after the program has been linked. |
1008 function can be called before or after the program has been linked. |
1005 Any attributes that have not been explicitly bound when the program |
1009 Any attributes that have not been explicitly bound when the program |
1006 is linked will be assigned locations automatically. |
1010 is linked will be assigned locations automatically. |
|
1011 |
|
1012 When this function is called after the program has been linked, |
|
1013 the program will need to be relinked for the change to take effect. |
1007 |
1014 |
1008 \sa attributeLocation() |
1015 \sa attributeLocation() |
1009 */ |
1016 */ |
1010 void QGLShaderProgram::bindAttributeLocation(const QString& name, int location) |
1017 void QGLShaderProgram::bindAttributeLocation(const QString& name, int location) |
1011 { |
1018 { |