CopperSpice API
1.9.2
|
The QOpenGLShaderProgram class allows OpenGL shader programs to be linked and used. More...
Public Methods | |
QOpenGLShaderProgram (QObject *parent=nullptr) | |
virtual | ~QOpenGLShaderProgram () |
bool | addShader (QOpenGLShader *shader) |
bool | addShaderFromSourceCode (QOpenGLShader::ShaderType type, const char *source) |
bool | addShaderFromSourceCode (QOpenGLShader::ShaderType type, const QByteArray &source) |
bool | addShaderFromSourceCode (QOpenGLShader::ShaderType type, const QString &source) |
bool | addShaderFromSourceFile (QOpenGLShader::ShaderType type, const QString &fileName) |
int | attributeLocation (const char *name) const |
int | attributeLocation (const QByteArray &name) const |
int | attributeLocation (const QString &name) const |
bool | bind () |
void | bindAttributeLocation (const char *name, int location) |
void | bindAttributeLocation (const QByteArray &name, int location) |
void | bindAttributeLocation (const QString &name, int location) |
bool | create () |
QVector< float > | defaultInnerTessellationLevels () const |
QVector< float > | defaultOuterTessellationLevels () const |
void | disableAttributeArray (const char *name) |
void | disableAttributeArray (int location) |
void | enableAttributeArray (const char *name) |
void | enableAttributeArray (int location) |
bool | isLinked () const |
virtual bool | link () |
QString | log () const |
int | maxGeometryOutputVertices () const |
int | patchVertexCount () const |
GLuint | programId () const |
void | release () |
void | removeAllShaders () |
void | removeShader (QOpenGLShader *shader) |
void | setAttributeArray (const char *name, const GLfloat *values, int tupleSize, int stride=0) |
void | setAttributeArray (const char *name, const QVector2D *values, int stride=0) |
void | setAttributeArray (const char *name, const QVector3D *values, int stride=0) |
void | setAttributeArray (const char *name, const QVector4D *values, int stride=0) |
void | setAttributeArray (const char *name, GLenum type, const void *values, int tupleSize, int stride=0) |
void | setAttributeArray (int location, const GLfloat *values, int tupleSize, int stride=0) |
void | setAttributeArray (int location, const QVector2D *values, int stride=0) |
void | setAttributeArray (int location, const QVector3D *values, int stride=0) |
void | setAttributeArray (int location, const QVector4D *values, int stride=0) |
void | setAttributeArray (int location, GLenum type, const void *values, int tupleSize, int stride=0) |
void | setAttributeBuffer (const char *name, GLenum type, int offset, int tupleSize, int stride=0) |
void | setAttributeBuffer (int location, GLenum type, int offset, int tupleSize, int stride=0) |
void | setAttributeValue (const char *name, const GLfloat *values, int columns, int rows) |
void | setAttributeValue (const char *name, const QColor &value) |
void | setAttributeValue (const char *name, const QVector2D &value) |
void | setAttributeValue (const char *name, const QVector3D &value) |
void | setAttributeValue (const char *name, const QVector4D &value) |
void | setAttributeValue (const char *name, GLfloat value) |
void | setAttributeValue (const char *name, GLfloat x, GLfloat y) |
void | setAttributeValue (const char *name, GLfloat x, GLfloat y, GLfloat z) |
void | setAttributeValue (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
void | setAttributeValue (int location, const GLfloat *values, int columns, int rows) |
void | setAttributeValue (int location, const QColor &value) |
void | setAttributeValue (int location, const QVector2D &value) |
void | setAttributeValue (int location, const QVector3D &value) |
void | setAttributeValue (int location, const QVector4D &value) |
void | setAttributeValue (int location, GLfloat value) |
void | setAttributeValue (int location, GLfloat x, GLfloat y) |
void | setAttributeValue (int location, GLfloat x, GLfloat y, GLfloat z) |
void | setAttributeValue (int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
void | setDefaultInnerTessellationLevels (const QVector< float > &levels) |
void | setDefaultOuterTessellationLevels (const QVector< float > &levels) |
void | setPatchVertexCount (int count) |
void | setUniformValue (const char *name, const GLfloat value[2][2]) |
void | setUniformValue (const char *name, const GLfloat value[3][3]) |
void | setUniformValue (const char *name, const GLfloat value[4][4]) |
void | setUniformValue (const char *name, const QColor &color) |
void | setUniformValue (const char *name, const QMatrix2x2 &value) |
void | setUniformValue (const char *name, const QMatrix2x3 &value) |
void | setUniformValue (const char *name, const QMatrix2x4 &value) |
void | setUniformValue (const char *name, const QMatrix3x2 &value) |
void | setUniformValue (const char *name, const QMatrix3x3 &value) |
void | setUniformValue (const char *name, const QMatrix3x4 &value) |
void | setUniformValue (const char *name, const QMatrix4x2 &value) |
void | setUniformValue (const char *name, const QMatrix4x3 &value) |
void | setUniformValue (const char *name, const QMatrix4x4 &value) |
void | setUniformValue (const char *name, const QPoint &point) |
void | setUniformValue (const char *name, const QPointF &point) |
void | setUniformValue (const char *name, const QSize &size) |
void | setUniformValue (const char *name, const QSizeF &size) |
void | setUniformValue (const char *name, const QTransform &value) |
void | setUniformValue (const char *name, const QVector2D &value) |
void | setUniformValue (const char *name, const QVector3D &value) |
void | setUniformValue (const char *name, const QVector4D &value) |
void | setUniformValue (const char *name, GLfloat value) |
void | setUniformValue (const char *name, GLfloat x, GLfloat y) |
void | setUniformValue (const char *name, GLfloat x, GLfloat y, GLfloat z) |
void | setUniformValue (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
void | setUniformValue (const char *name, GLint value) |
void | setUniformValue (const char *name, GLuint value) |
void | setUniformValue (int location, const GLfloat value[2][2]) |
void | setUniformValue (int location, const GLfloat value[3][3]) |
void | setUniformValue (int location, const GLfloat value[4][4]) |
void | setUniformValue (int location, const QColor &color) |
void | setUniformValue (int location, const QMatrix2x2 &value) |
void | setUniformValue (int location, const QMatrix2x3 &value) |
void | setUniformValue (int location, const QMatrix2x4 &value) |
void | setUniformValue (int location, const QMatrix3x2 &value) |
void | setUniformValue (int location, const QMatrix3x3 &value) |
void | setUniformValue (int location, const QMatrix3x4 &value) |
void | setUniformValue (int location, const QMatrix4x2 &value) |
void | setUniformValue (int location, const QMatrix4x3 &value) |
void | setUniformValue (int location, const QMatrix4x4 &value) |
void | setUniformValue (int location, const QPoint &point) |
void | setUniformValue (int location, const QPointF &point) |
void | setUniformValue (int location, const QSize &size) |
void | setUniformValue (int location, const QSizeF &size) |
void | setUniformValue (int location, const QTransform &value) |
void | setUniformValue (int location, const QVector2D &value) |
void | setUniformValue (int location, const QVector3D &value) |
void | setUniformValue (int location, const QVector4D &value) |
void | setUniformValue (int location, GLfloat value) |
void | setUniformValue (int location, GLfloat x, GLfloat y) |
void | setUniformValue (int location, GLfloat x, GLfloat y, GLfloat z) |
void | setUniformValue (int location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) |
void | setUniformValue (int location, GLint value) |
void | setUniformValue (int location, GLuint value) |
void | setUniformValueArray (const char *name, const GLfloat *values, int count, int tupleSize) |
void | setUniformValueArray (const char *name, const GLint *values, int count) |
void | setUniformValueArray (const char *name, const GLuint *values, int count) |
void | setUniformValueArray (const char *name, const QMatrix2x2 *values, int count) |
void | setUniformValueArray (const char *name, const QMatrix2x3 *values, int count) |
void | setUniformValueArray (const char *name, const QMatrix2x4 *values, int count) |
void | setUniformValueArray (const char *name, const QMatrix3x2 *values, int count) |
void | setUniformValueArray (const char *name, const QMatrix3x3 *values, int count) |
void | setUniformValueArray (const char *name, const QMatrix3x4 *values, int count) |
void | setUniformValueArray (const char *name, const QMatrix4x2 *values, int count) |
void | setUniformValueArray (const char *name, const QMatrix4x3 *values, int count) |
void | setUniformValueArray (const char *name, const QMatrix4x4 *values, int count) |
void | setUniformValueArray (const char *name, const QVector2D *values, int count) |
void | setUniformValueArray (const char *name, const QVector3D *values, int count) |
void | setUniformValueArray (const char *name, const QVector4D *values, int count) |
void | setUniformValueArray (int location, const GLfloat *values, int count, int tupleSize) |
void | setUniformValueArray (int location, const GLint *values, int count) |
void | setUniformValueArray (int location, const GLuint *values, int count) |
void | setUniformValueArray (int location, const QMatrix2x2 *values, int count) |
void | setUniformValueArray (int location, const QMatrix2x3 *values, int count) |
void | setUniformValueArray (int location, const QMatrix2x4 *values, int count) |
void | setUniformValueArray (int location, const QMatrix3x2 *values, int count) |
void | setUniformValueArray (int location, const QMatrix3x3 *values, int count) |
void | setUniformValueArray (int location, const QMatrix3x4 *values, int count) |
void | setUniformValueArray (int location, const QMatrix4x2 *values, int count) |
void | setUniformValueArray (int location, const QMatrix4x3 *values, int count) |
void | setUniformValueArray (int location, const QMatrix4x4 *values, int count) |
void | setUniformValueArray (int location, const QVector2D *values, int count) |
void | setUniformValueArray (int location, const QVector3D *values, int count) |
void | setUniformValueArray (int location, const QVector4D *values, int count) |
QList< QOpenGLShader * > | shaders () const |
int | uniformLocation (const char *name) const |
int | uniformLocation (const QByteArray &name) const |
int | uniformLocation (const QString &name) const |
Public Methods inherited from QObject | |
QObject (QObject *parent=nullptr) | |
~QObject () | |
bool | blockSignals (bool block) |
const QList< QObject * > & | children () const |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QString > | dynamicPropertyNames () const |
virtual bool | event (QEvent *event) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
template<typename T > | |
T | findChild (const QString &childName=QString ()) const |
template<class T > | |
QList< T > | findChildren (const QRegularExpression ®Exp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
template<class T > | |
QList< T > | findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
bool | inherits (const QString &className) const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const |
bool | isWindowType () const |
void | killTimer (int id) |
const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const |
QObject * | parent () const |
template<class T = QVariant> | |
T | property (const QString &name) const |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const QString &name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
QThread * | thread () const |
Static Public Methods | |
static bool | hasOpenGLShaderPrograms (QOpenGLContext *context=nullptr) |
Static Public Methods inherited from QObject | |
static bool | connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ()) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...)) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod) |
static QMetaObject & | staticMetaObject () |
static QString | tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >()) |
Additional Inherited Members | |
Public Signals inherited from QObject | |
void | destroyed (QObject *obj=nullptr) |
void | objectNameChanged (const QString &objectName) |
Public Slots inherited from QObject | |
void | deleteLater () |
Protected Methods inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signalMethod) const |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signalMethod) const |
bool | isSignalConnected (const QMetaMethod &signalMethod) const |
int | receivers (const QString &signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Properties inherited from QObject | |
objectName | |
Related Functions inherited from QObject | |
T | qobject_cast (QObject *object) |
QObjectList | |
This class supports shader programs written in the OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES). QOpenGLShader and QOpenGLShaderProgram encapsulate the details of compiling and linking vertex and fragment shaders.
The following example creates a vertex shader program. Once it is compiled and linked the shader program is activated in the current QOpenGLContext by calling QOpenGLShaderProgram::bind().
Shader programs can be difficult to reuse across OpenGL implementations because of varying levels of support for standard vertex attributes and uniform variables. In particular, GLSL/ES lacks all of the standard variables that are present on desktop OpenGL systems: gl_Vertex, gl_Normal, gl_Color, and so on. Desktop OpenGL lacks the variable qualifiers highp, mediump, and lowp.
The QOpenGLShaderProgram class makes the process of writing portable shaders easier by prefixing all shader programs with the following lines on desktop OpenGL. This makes it possible to run most GLSL/ES shader programs on desktop systems. The programmer should restrict themselves to just features that are present in GLSL/ES, and avoid standard variable names that only work on the desktop.
The following block of code sets up a shader program.
Using this shader program we can draw a green triangle.
Binary shaders may be specified using glShaderBinary() on the return value from QOpenGLShader::shaderId(). The QOpenGLShader instance containing the binary can then be added to the shader program with addShader() and linked in the usual fashion with link().
Binary programs may be specified using glProgramBinaryOES() on the return value from programId(). Then the application should call link(), which will notice that the program has already been specified and linked, allowing other operations to be performed on the shader program. The shader program's id can be explicitly created using the create() method.
|
explicit |
Constructs a new shader program and attaches it to parent. The program will be invalid until addShader() is called. The shader program will be associated with the current QOpenGLContext.
|
virtual |
Deletes this QOpenGLShaderProgram.
bool QOpenGLShaderProgram::addShader | ( | QOpenGLShader * | shader | ) |
Adds a compiled shader to this shader program. Returns true if the shader could be added, otherwise returns false. Ownership of the shader object remains with the caller. It will not be deleted when this QOpenGLShaderProgram instance is deleted. This allows the caller to add the same shader to multiple shader programs.
bool QOpenGLShaderProgram::addShaderFromSourceCode | ( | QOpenGLShader::ShaderType | type, |
const char * | source | ||
) |
Compiles source as a shader of the specified type and adds it to this shader program. Returns true if compilation was successful, otherwise returns false. The compilation errors and warnings will be made available via log().
This method is a shortcut to add a vertex or fragment shader to a shader program without needing to create a QOpenGLShader.
bool QOpenGLShaderProgram::addShaderFromSourceCode | ( | QOpenGLShader::ShaderType | type, |
const QByteArray & | source | ||
) |
Compiles source as a shader of the specified type and adds it to this shader program. Returns true if compilation was successful, otherwise returns false. The compilation errors and warnings will be made available via log().
This method is a shortcut to add a vertex or fragment shader to a shader program without needing to create a QOpenGLShader.
bool QOpenGLShaderProgram::addShaderFromSourceCode | ( | QOpenGLShader::ShaderType | type, |
const QString & | source | ||
) |
Compiles source as a shader of the specified type and adds it to this shader program. Returns true if compilation was successful, otherwise returns false. The compilation errors and warnings will be made available via log().
This method is a shortcut to add a vertex or fragment shader to a shader program without needing to create a QOpenGLShader.
bool QOpenGLShaderProgram::addShaderFromSourceFile | ( | QOpenGLShader::ShaderType | type, |
const QString & | fileName | ||
) |
Compiles the contents of fileName as a shader of the specified type and adds it to this shader program. Returns true if compilation was successful, otherwise returns false. The compilation errors and warnings will be made available via log().
This method is a shortcut to add a vertex or fragment shader to a shader program without needing to create a QOpenGLShader.
int QOpenGLShaderProgram::attributeLocation | ( | const char * | name | ) | const |
Returns the position of the attribute with the given name. A return value of -1 indicates the name is not a valid attribute for this shader program.
int QOpenGLShaderProgram::attributeLocation | ( | const QByteArray & | name | ) | const |
Returns the position of the attribute with the given name. A return value of -1 indicates the name is not a valid attribute for this shader program.
int QOpenGLShaderProgram::attributeLocation | ( | const QString & | name | ) | const |
Returns the position of the attribute with the given name. A return value of -1 indicates the name is not a valid attribute for this shader program.
bool QOpenGLShaderProgram::bind | ( | ) |
Binds this QOpenGLShaderProgram to the active QOpenGLContext. The shader program becomes active and is used for rendering. Any previously bound shader program is released. Returns true if the program was successfully bound, otherwise false is returned.
If the shader program has not been linked or it needs to be relinked this method will automatically call link().
Equivalent to calling glUseProgram() and passing the programId().
void QOpenGLShaderProgram::bindAttributeLocation | ( | const char * | name, |
int | location | ||
) |
Binds the attribute name to the specified location. This method can be called before or after the program has been linked. Any attributes that have not been explicitly bound when the program is linked will be assigned locations automatically.
If this method is called after the shader program has been linked the shader program will need to be relinked.
void QOpenGLShaderProgram::bindAttributeLocation | ( | const QByteArray & | name, |
int | location | ||
) |
Binds the attribute name to the specified location. This method can be called before or after the program has been linked. Any attributes that have not been explicitly bound when the program is linked will be assigned locations automatically.
If this method is called after the shader program has been linked the shader program will need to be relinked.
void QOpenGLShaderProgram::bindAttributeLocation | ( | const QString & | name, |
int | location | ||
) |
Binds the attribute name to the specified location. This method can be called before or after the program has been linked. Any attributes that have not been explicitly bound when the program is linked will be assigned locations automatically.
If this method is called after the shader program has been linked the shader program will need to be relinked.
bool QOpenGLShaderProgram::create | ( | ) |
Requests the shader program's id to be created immediately. Returns true if successful, otherwise returns false. This method is primarily useful when combining QOpenGLShaderProgram with other OpenGL functions that operate directly on the shader program id, like GL_OES_get_program_binary.
When the shader program is used normally, the shader program's id will be created on demand.
QVector< float > QOpenGLShaderProgram::defaultInnerTessellationLevels | ( | ) | const |
Returns a QVector of floats describing the inner tessellation levels. The vector will always have two elements but not all of them may be used for every mode of tessellation. These default inner tessellation levels will be used by the tessellation primitive generator if the tessellation control shader does not provide any.
QVector< float > QOpenGLShaderProgram::defaultOuterTessellationLevels | ( | ) | const |
Returns a QVector of floats describing the outer tessellation levels. The vector will always have two elements but not all of them may be used for every mode of tessellation. These default outer tessellation levels will be used by the tessellation primitive generator if the tessellation control shader does not provide any.
void QOpenGLShaderProgram::disableAttributeArray | ( | const char * | name | ) |
Disables the vertex array called name in this shader program that was enabled by a previous call to enableAttributeArray().
void QOpenGLShaderProgram::disableAttributeArray | ( | int | location | ) |
Disables the vertex array at location in this shader program that was enabled by a previous call to enableAttributeArray().
void QOpenGLShaderProgram::enableAttributeArray | ( | const char * | name | ) |
Enables the vertex array called name in this shader program so that the value set by setAttributeArray() on name will be used by the shader program.
void QOpenGLShaderProgram::enableAttributeArray | ( | int | location | ) |
Enables the vertex array at location in this shader program so that the value set by setAttributeArray() on location will be used by the shader program.
|
static |
The context is used to resolve the GLSL extensions. If context is nullptr, then QOpenGLContext::currentContext() is used. Returns true if shader programs written in the OpenGL Shading Language (GLSL) are supported on this system, otherwise false is returned.
bool QOpenGLShaderProgram::isLinked | ( | ) | const |
Returns true if this shader program has been linked, otherwise false is returned.
|
virtual |
Links together the shaders that were added to this program with addShader(). Returns true if the link was successful or otherwise returns false. If the link failed, the error messages can be retrieved with log(). Subclasses can override this method to initialize attributes and uniform variables for use in specific shader programs.
If the shader program was already linked, calling this method again will force it to be relinked.
When shaders were added to this program via addCacheableShaderFromSourceCode() or addCacheableShaderFromSourceFile(), program binaries are supported, and a cached binary is available on disk, actual compilation and linking are skipped. Instead, this method will initialize the program with the binary blob via glProgramBinary(). If there is no cached version of the program or it was generated with a different driver version, the shaders will be compiled from source and the program will get linked normally. This allows seamless upgrading of the graphics drivers, without having to worry about potentially incompatible binary formats.
QString QOpenGLShaderProgram::log | ( | ) | const |
Returns the errors and warnings that occurred during the last link() or addShader() with explicitly specified source code.
int QOpenGLShaderProgram::maxGeometryOutputVertices | ( | ) | const |
Returns the hardware limit for how many vertices a geometry shader can output.
int QOpenGLShaderProgram::patchVertexCount | ( | ) | const |
Returns the number of vertices per patch to be used when rendering.
GLuint QOpenGLShaderProgram::programId | ( | ) | const |
Returns the OpenGL identifier associated with this shader program.
void QOpenGLShaderProgram::release | ( | ) |
Releases the active shader program from the current QOpenGLContext. This is equivalent to calling glUseProgram(0).
void QOpenGLShaderProgram::removeAllShaders | ( | ) |
Removes all of the shaders that were added to this program previously. The QOpenGLShader objects for the shaders will not be deleted if they were constructed externally. QOpenGLShader objects that are constructed internally by QOpenGLShaderProgram will be deleted.
void QOpenGLShaderProgram::removeShader | ( | QOpenGLShader * | shader | ) |
Removes shader from this shader program. The object is not deleted. The shader program must be valid in the current QOpenGLContext.
void QOpenGLShaderProgram::setAttributeArray | ( | const char * | name, |
const GLfloat * | values, | ||
int | tupleSize, | ||
int | stride = 0 |
||
) |
Sets an array of vertex values on the attribute called name in this shader program. The tupleSize indicates the number of components per vertex (1, 2, 3, or 4), and the stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in values.
The array will become active when enableAttributeArray() is called on name. Otherwise the value specified with setAttributeValue() for name will be used.
void QOpenGLShaderProgram::setAttributeArray | ( | const char * | name, |
const QVector2D * | values, | ||
int | stride = 0 |
||
) |
Sets an array of 2D vertex values on the attribute called name in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in values.
The array will become active when enableAttributeArray() is called on name. Otherwise the value specified with setAttributeValue() for name will be used.
void QOpenGLShaderProgram::setAttributeArray | ( | const char * | name, |
const QVector3D * | values, | ||
int | stride = 0 |
||
) |
Sets an array of 3D vertex values on the attribute called name in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in values.
The array will become active when enableAttributeArray() is called on name. Otherwise the value specified with setAttributeValue() for name will be used.
void QOpenGLShaderProgram::setAttributeArray | ( | const char * | name, |
const QVector4D * | values, | ||
int | stride = 0 |
||
) |
Sets an array of 4D vertex values on the attribute called name in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in values.
The array will become active when enableAttributeArray() is called on name. Otherwise the value specified with setAttributeValue() for name will be used.
void QOpenGLShaderProgram::setAttributeArray | ( | const char * | name, |
GLenum | type, | ||
const void * | values, | ||
int | tupleSize, | ||
int | stride = 0 |
||
) |
Sets an array of vertex values on the attribute called name in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in values.
The type indicates the type of elements in the values array, usually GL_FLOAT, GL_UNSIGNED_BYTE, etc. The tupleSize indicates the number of components per vertex: 1, 2, 3, or 4.
The array will become active when enableAttributeArray() is called on the name. Otherwise the value specified with setAttributeValue() for name will be used. The setAttributeBuffer() method can be used to set the attribute array to an offset within a vertex buffer.
void QOpenGLShaderProgram::setAttributeArray | ( | int | location, |
const GLfloat * | values, | ||
int | tupleSize, | ||
int | stride = 0 |
||
) |
Sets an array of vertex values on the attribute at location in this shader program. The tupleSize indicates the number of components per vertex (1, 2, 3, or 4), and the stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in values.
The array will become active when enableAttributeArray() is called on the location. Otherwise the value specified with setAttributeValue() for location will be used.
void QOpenGLShaderProgram::setAttributeArray | ( | int | location, |
const QVector2D * | values, | ||
int | stride = 0 |
||
) |
Sets an array of 2D vertex values on the attribute at location in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in values.
The array will become active when enableAttributeArray() is called on the location. Otherwise the value specified with setAttributeValue() for location will be used.
void QOpenGLShaderProgram::setAttributeArray | ( | int | location, |
const QVector3D * | values, | ||
int | stride = 0 |
||
) |
Sets an array of 3D vertex values on the attribute at location in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in values.
The array will become active when enableAttributeArray() is called on the location. Otherwise the value specified with setAttributeValue() for location will be used.
void QOpenGLShaderProgram::setAttributeArray | ( | int | location, |
const QVector4D * | values, | ||
int | stride = 0 |
||
) |
Sets an array of 4D vertex values on the attribute at location in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in values.
The array will become active when enableAttributeArray() is called on the location. Otherwise the value specified with setAttributeValue() for location will be used.
void QOpenGLShaderProgram::setAttributeArray | ( | int | location, |
GLenum | type, | ||
const void * | values, | ||
int | tupleSize, | ||
int | stride = 0 |
||
) |
Sets an array of vertex values on the attribute at location in this shader program. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in values.
The type indicates the type of elements in the values array, usually GL_FLOAT, GL_UNSIGNED_BYTE, etc. The tupleSize indicates the number of components per vertex: 1, 2, 3, or 4.
The array will become active when enableAttributeArray() is called on the location. Otherwise the value specified with setAttributeValue() for location will be used. The setAttributeBuffer() method can be used to set the attribute array to an offset within a vertex buffer.
Normalization will be enabled. If this is not desired, call glVertexAttribPointer directly through QOpenGLFunctions.
void QOpenGLShaderProgram::setAttributeBuffer | ( | const char * | name, |
GLenum | type, | ||
int | offset, | ||
int | tupleSize, | ||
int | stride = 0 |
||
) |
Sets an array of vertex values on the attribute called name in this shader program, starting at a specific offset in the currently bound vertex buffer. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in the value array.
The type indicates the type of elements in the vertex value array, usually GL_FLOAT, GL_UNSIGNED_BYTE, etc. The tupleSize indicates the number of components per vertex: 1, 2, 3, or 4.
The array will become active when enableAttributeArray() is called on the name. Otherwise the value specified with setAttributeValue() for name will be used.
void QOpenGLShaderProgram::setAttributeBuffer | ( | int | location, |
GLenum | type, | ||
int | offset, | ||
int | tupleSize, | ||
int | stride = 0 |
||
) |
Sets an array of vertex values on the attribute at location in this shader program, starting at a specific offset in the currently bound vertex buffer. The stride indicates the number of bytes between vertices. A default stride value of zero indicates that the vertices are densely packed in the value array.
The type indicates the type of elements in the vertex value array, usually GL_FLOAT, GL_UNSIGNED_BYTE, etc. The tupleSize indicates the number of components per vertex: 1, 2, 3, or 4.
The array will become active when enableAttributeArray() is called on the location. Otherwise the value specified with setAttributeValue() for location will be used.
Normalization will be enabled. If this is not desired, call glVertexAttribPointer directly through QOpenGLFunctions.
void QOpenGLShaderProgram::setAttributeValue | ( | const char * | name, |
const GLfloat * | values, | ||
int | columns, | ||
int | rows | ||
) |
Sets the attribute called name in the current context to the contents of values, which contains columns elements, each consisting of rows elements. The rows value should be 1, 2, 3, or 4. This method is typically used to set matrix values and column vectors.
void QOpenGLShaderProgram::setAttributeValue | ( | const char * | name, |
const QColor & | value | ||
) |
Sets the attribute called name in the current context to value.
void QOpenGLShaderProgram::setAttributeValue | ( | const char * | name, |
const QVector2D & | value | ||
) |
Sets the attribute called name in the current context to value.
void QOpenGLShaderProgram::setAttributeValue | ( | const char * | name, |
const QVector3D & | value | ||
) |
Sets the attribute called name in the current context to value.
void QOpenGLShaderProgram::setAttributeValue | ( | const char * | name, |
const QVector4D & | value | ||
) |
Sets the attribute called name in the current context to value.
void QOpenGLShaderProgram::setAttributeValue | ( | const char * | name, |
GLfloat | value | ||
) |
Sets the attribute called name in the current context to value.
void QOpenGLShaderProgram::setAttributeValue | ( | const char * | name, |
GLfloat | x, | ||
GLfloat | y | ||
) |
Sets the attribute called name in the current context to the 2D vector (x, y).
void QOpenGLShaderProgram::setAttributeValue | ( | const char * | name, |
GLfloat | x, | ||
GLfloat | y, | ||
GLfloat | z | ||
) |
Sets the attribute called name in the current context to the 3D vector (x, y, z).
void QOpenGLShaderProgram::setAttributeValue | ( | const char * | name, |
GLfloat | x, | ||
GLfloat | y, | ||
GLfloat | z, | ||
GLfloat | w | ||
) |
Sets the attribute called name in the current context to the 4D vector (x, y, z, w).
void QOpenGLShaderProgram::setAttributeValue | ( | int | location, |
const GLfloat * | values, | ||
int | columns, | ||
int | rows | ||
) |
Sets the attribute at location in the current context to the contents of values, which contains columns elements, each consisting of rows elements. The rows value should be 1, 2, 3, or 4. This method is typically used to set matrix values and column vectors.
void QOpenGLShaderProgram::setAttributeValue | ( | int | location, |
const QColor & | value | ||
) |
Sets the attribute at location in the current context to value.
void QOpenGLShaderProgram::setAttributeValue | ( | int | location, |
const QVector2D & | value | ||
) |
Sets the attribute at location in the current context to value.
void QOpenGLShaderProgram::setAttributeValue | ( | int | location, |
const QVector3D & | value | ||
) |
Sets the attribute at location in the current context to value.
void QOpenGLShaderProgram::setAttributeValue | ( | int | location, |
const QVector4D & | value | ||
) |
Sets the attribute at location in the current context to value.
void QOpenGLShaderProgram::setAttributeValue | ( | int | location, |
GLfloat | value | ||
) |
Sets the attribute at location in the current context to value.
void QOpenGLShaderProgram::setAttributeValue | ( | int | location, |
GLfloat | x, | ||
GLfloat | y | ||
) |
Sets the attribute at location in the current context to the 2D vector (x, y).
void QOpenGLShaderProgram::setAttributeValue | ( | int | location, |
GLfloat | x, | ||
GLfloat | y, | ||
GLfloat | z | ||
) |
Sets the attribute at location in the current context to the 3D vector (x, y, z).
void QOpenGLShaderProgram::setAttributeValue | ( | int | location, |
GLfloat | x, | ||
GLfloat | y, | ||
GLfloat | z, | ||
GLfloat | w | ||
) |
Sets the attribute at location in the current context to the 4D vector (x, y, z, w).
void QOpenGLShaderProgram::setDefaultInnerTessellationLevels | ( | const QVector< float > & | levels | ) |
Sets the default outer tessellation levels to be used by the tessellation primitive generator in the event that the tessellation control shader does not output them to levels. For more details on OpenGL and Tessellation shaders see OpenGL Tessellation Shaders.
The levels argument should be a QVector consisting of 2 floats. Not all of the values make sense for all tessellation modes. If you specify a vector with fewer than 2 elements, the remaining elements will be given a default value of 1.
Calling this method will modify the global OpenGL state and the values are not isolated to this specific QOpenGLShaderProgram instance.
void QOpenGLShaderProgram::setDefaultOuterTessellationLevels | ( | const QVector< float > & | levels | ) |
Sets the default outer tessellation levels to be used by the tessellation primitive generator in the event that the tessellation control shader does not output them to levels. For more details on OpenGL and Tessellation shaders see OpenGL Tessellation Shaders.
The levels argument should be a QVector consisting of 4 floats. Not all of the values make sense for all tessellation modes. If you specify a vector with fewer than 4 elements, the remaining elements will be given a default value of 1.
Calling this method will modify the global OpenGL state and the values are not isolated to this specific QOpenGLShaderProgram instance.
void QOpenGLShaderProgram::setPatchVertexCount | ( | int | count | ) |
Use this method to specify to OpenGL the number of vertices in a patch to count. A patch is a custom OpenGL primitive whose interpretation is entirely defined by the tessellation shader stages. Therefore, calling this method only makes sense when using a QOpenGLShaderProgram containing tessellation stage shaders. When using OpenGL tessellation, the only primitive that can be rendered with glDraw*() functions is GL_PATCHES.
Equivalent to calling glPatchParameteri(GL_PATCH_VERTICES, count).
Calling this method will modify the global OpenGL state and the values are not isolated to this specific QOpenGLShaderProgram instance.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const GLfloat | value[2][2] = 2 |
||
) |
Sets the uniform variable called name in the current context to a 2x2 matrix value. The matrix elements must be specified in column-major order.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const GLfloat | value[3][3] = 3 |
||
) |
Sets the uniform variable called name in the current context to a 3x3 matrix value. The matrix elements must be specified in column-major order.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const GLfloat | value[4][4] = 4 |
||
) |
Sets the uniform variable called name in the current context to a 4x4 matrix value. The matrix elements must be specified in column-major order.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QColor & | color | ||
) |
Sets the uniform variable called name in the current context to the red, green, blue, and alpha components of color.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QMatrix2x2 & | value | ||
) |
Sets the uniform variable called name in the current context to a 2x2 matrix value.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QMatrix2x3 & | value | ||
) |
Sets the uniform variable called name in the current context to a 2x3 matrix value.
This method is not aware of non square matrix support for GLSL types like mat2x3 which are present in modern OpenGL versions. Instead, it treats the uniform as an array of vec3.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QMatrix2x4 & | value | ||
) |
Sets the uniform variable called name in the current context to a 2x4 matrix value.
This method is not aware of non square matrix support for GLSL types like mat2x4 which are present in modern OpenGL versions. Instead, it treats the uniform as an array of vec4.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QMatrix3x2 & | value | ||
) |
Sets the uniform variable called name in the current context to a 3x2 matrix value.
This method is not aware of non square matrix support for GLSL types like mat3x2 which are present in modern OpenGL versions. Instead, it treats the uniform as an array of vec2.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QMatrix3x3 & | value | ||
) |
Sets the uniform variable called name in the current context to a 3x3 matrix value.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QMatrix3x4 & | value | ||
) |
Sets the uniform variable called name in the current context to a 3x4 matrix value.
This method is not aware of non square matrix support for GLSL types like mat3x4 which are present in modern OpenGL versions. Instead, it treats the uniform as an array of vec4.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QMatrix4x2 & | value | ||
) |
Sets the uniform variable called name in the current context to a 4x2 matrix value.
This method is not aware of non square matrix support for GLSL types like mat4x2 which are present in modern OpenGL versions. Instead, it treats the uniform as an array of vec2.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QMatrix4x3 & | value | ||
) |
Sets the uniform variable called name in the current context to a 4x3 matrix value.
This method is not aware of non square matrix support for GLSL types like mat4x3 which are present in modern OpenGL versions. Instead, it treats the uniform as an array of vec3.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QMatrix4x4 & | value | ||
) |
Sets the uniform variable called name in the current context to a 4x4 matrix value.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QPoint & | point | ||
) |
Sets the uniform variable associated with name in the current context to the x and y coordinates of point.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QPointF & | point | ||
) |
Sets the uniform variable associated with name in the current context to the x and y coordinates of point.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QSize & | size | ||
) |
Sets the uniform variable associated with name in the current context to the width and height of the given size.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QSizeF & | size | ||
) |
Sets the uniform variable associated with name in the current context to the width and height of the given size.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QTransform & | value | ||
) |
Sets the uniform variable called name in the current context to a 3x3 transformation matrix value that is specified as a QTransform value.
To set a QTransform value as a 4x4 matrix in a shader, use setUniformValue(name, QMatrix4x4(value)).
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QVector2D & | value | ||
) |
Sets the uniform variable called name in the current context to value.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QVector3D & | value | ||
) |
Sets the uniform variable called name in the current context to value.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
const QVector4D & | value | ||
) |
Sets the uniform variable called name in the current context to value.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
GLfloat | value | ||
) |
Sets the uniform variable called name in the current context to value.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
GLfloat | x, | ||
GLfloat | y | ||
) |
Sets the uniform variable called name in the current context to the 2D vector (x, y).
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
GLfloat | x, | ||
GLfloat | y, | ||
GLfloat | z | ||
) |
Sets the uniform variable called name in the current context to the 3D vector (x, y, z).
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
GLfloat | x, | ||
GLfloat | y, | ||
GLfloat | z, | ||
GLfloat | w | ||
) |
Sets the uniform variable called name in the current context to the 4D vector (x, y, z, w).
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
GLint | value | ||
) |
Sets the uniform variable called name in the current context to value.
void QOpenGLShaderProgram::setUniformValue | ( | const char * | name, |
GLuint | value | ||
) |
Sets the uniform variable called name in the current context to value.
This method is not aware of unsigned int support in modern OpenGL versions and therefore treats value as a GLint and calls glUniform1i.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const GLfloat | value[2][2] = 2 |
||
) |
Sets the uniform variable at location in the current context to a 2x2 matrix value. The matrix elements must be specified in column-major order.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const GLfloat | value[3][3] = 3 |
||
) |
Sets the uniform variable at location in the current context to a 3x3 matrix value. The matrix elements must be specified in column-major order.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const GLfloat | value[4][4] = 4 |
||
) |
Sets the uniform variable at location in the current context to a 4x4 matrix value. The matrix elements must be specified in column-major order.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QColor & | color | ||
) |
Sets the uniform variable at location in the current context to the red, green, blue, and alpha components of color.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QMatrix2x2 & | value | ||
) |
Sets the uniform variable at location in the current context to a 2x2 matrix value.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QMatrix2x3 & | value | ||
) |
Sets the uniform variable at location in the current context to a 2x3 matrix value.
This method is not aware of non square matrix support for GLSL types like mat2x3 which are present in modern OpenGL versions. Instead, it treats the uniform as an array of vec3.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QMatrix2x4 & | value | ||
) |
Sets the uniform variable at location in the current context to a 2x4 matrix value.
This method is not aware of non square matrix support for GLSL types like mat2x4 which are present in modern OpenGL versions. Instead, it treats the uniform as an array of vec4.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QMatrix3x2 & | value | ||
) |
Sets the uniform variable at location in the current context to a 3x2 matrix value.
This method is not aware of non square matrix support for GLSL types like mat3x2 which are present in modern OpenGL versions. Instead, it treats the uniform as an array of vec2.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QMatrix3x3 & | value | ||
) |
Sets the uniform variable at location in the current context to a 3x3 matrix value.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QMatrix3x4 & | value | ||
) |
Sets the uniform variable at location in the current context to a 3x4 matrix value.
This method is not aware of non square matrix support for GLSL types like mat3x4 which are present in modern OpenGL versions. Instead, it treats the uniform as an array of vec4.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QMatrix4x2 & | value | ||
) |
Sets the uniform variable at location in the current context to a 4x2 matrix value.
This method is not aware of non square matrix support for GLSL types like mat4x2 which are present in modern OpenGL versions. Instead, it treats the uniform as an array of vec2.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QMatrix4x3 & | value | ||
) |
Sets the uniform variable at location in the current context to a 4x3 matrix value.
This method is not aware of non square matrix support for GLSL types like mat4x3 which are present in modern OpenGL versions. Instead, it treats the uniform as an array of vec3.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QMatrix4x4 & | value | ||
) |
Sets the uniform variable at location in the current context to a 4x4 matrix value.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QPoint & | point | ||
) |
Sets the uniform variable at location in the current context to the x and y coordinates of point.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QPointF & | point | ||
) |
Sets the uniform variable at location in the current context to the x and y coordinates of point.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QSize & | size | ||
) |
Sets the uniform variable at location in the current context to the width and height of the given size.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QSizeF & | size | ||
) |
Sets the uniform variable at location in the current context to the width and height of the given size.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QTransform & | value | ||
) |
Sets the uniform variable at location in the current context to a 3x3 transformation matrix value that is specified as a QTransform value. To set a QTransform value as a 4x4 matrix in a shader, use setUniformValue(location, QMatrix4x4(value)).
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QVector2D & | value | ||
) |
Sets the uniform variable at location in the current context to value.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QVector3D & | value | ||
) |
Sets the uniform variable at location in the current context to value.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
const QVector4D & | value | ||
) |
Sets the uniform variable at location in the current context to value.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
GLfloat | value | ||
) |
Sets the uniform variable at location in the current context to value.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
GLfloat | x, | ||
GLfloat | y | ||
) |
Sets the uniform variable at location in the current context to the 2D vector (x, y).
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
GLfloat | x, | ||
GLfloat | y, | ||
GLfloat | z | ||
) |
Sets the uniform variable at location in the current context to the 3D vector (x, y, z).
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
GLfloat | x, | ||
GLfloat | y, | ||
GLfloat | z, | ||
GLfloat | w | ||
) |
Sets the uniform variable at location in the current context to the 4D vector (x, y, z, w).
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
GLint | value | ||
) |
Sets the uniform variable at location in the current context to value.
void QOpenGLShaderProgram::setUniformValue | ( | int | location, |
GLuint | value | ||
) |
Sets the uniform variable at location in the current context to value. This method should be used when setting sampler values.
This method is not aware of unsigned int support in modern OpenGL versions and therefore treats value as a GLint and calls glUniform1i.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const GLfloat * | values, | ||
int | count, | ||
int | tupleSize | ||
) |
Sets the uniform variable array called name in the current context to the count elements of values. Each element has tupleSize components. The tupleSize must be 1, 2, 3, or 4.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const GLint * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const GLuint * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const QMatrix2x2 * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count 2x2 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const QMatrix2x3 * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count 2x3 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const QMatrix2x4 * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count 2x4 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const QMatrix3x2 * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count 3x2 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const QMatrix3x3 * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count 3x3 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const QMatrix3x4 * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count 3x4 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const QMatrix4x2 * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count 4x2 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const QMatrix4x3 * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count 4x3 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const QMatrix4x4 * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count 4x4 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const QVector2D * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count 2D vector elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const QVector3D * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count 3D vector elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | const char * | name, |
const QVector4D * | values, | ||
int | count | ||
) |
Sets the uniform variable array called name in the current context to the count 4D vector elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const GLfloat * | values, | ||
int | count, | ||
int | tupleSize | ||
) |
Sets the uniform variable array at location in the current context to the count elements of values. Each element has tupleSize components. The tupleSize must be 1, 2, 3, or 4.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const GLint * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const GLuint * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count elements of values. This overload should be used when setting an array of sampler values.
This method is not aware of unsigned int support in modern OpenGL versions and therefore treats values as a GLint and calls glUniform1iv.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const QMatrix2x2 * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count 2x2 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const QMatrix2x3 * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count 2x3 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const QMatrix2x4 * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count 2x4 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const QMatrix3x2 * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count 3x2 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const QMatrix3x3 * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count 3x3 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const QMatrix3x4 * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count 3x4 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const QMatrix4x2 * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count 4x2 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const QMatrix4x3 * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count 4x3 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const QMatrix4x4 * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count 4x4 matrix elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const QVector2D * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count 2D vector elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const QVector3D * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count 3D vector elements of values.
void QOpenGLShaderProgram::setUniformValueArray | ( | int | location, |
const QVector4D * | values, | ||
int | count | ||
) |
Sets the uniform variable array at location in the current context to the count 4D vector elements of values.
QList< QOpenGLShader * > QOpenGLShaderProgram::shaders | ( | ) | const |
Returns a list of all shaders that have been added to this shader program using addShader().
int QOpenGLShaderProgram::uniformLocation | ( | const char * | name | ) | const |
Returns the location of the uniform variable name within this shader program's parameter list. A return value of -1 indicates the name is not a valid uniform variable for this shader program.
int QOpenGLShaderProgram::uniformLocation | ( | const QByteArray & | name | ) | const |
Returns the location of the uniform variable name within this shader program's parameter list. A return value of -1 indicates the name is not a valid uniform variable for this shader program.
int QOpenGLShaderProgram::uniformLocation | ( | const QString & | name | ) | const |
Returns the location of the uniform variable name within this shader program's parameter list. A return value of -1 indicates the name is not a valid uniform variable for this shader program.