Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QOpenGLShaderProgram Class Reference

The QOpenGLShaderProgram class allows OpenGL shader programs to be linked and used. More...

#include <qopenglshaderprogram.h>

Inheritance diagram for QOpenGLShaderProgram:
Collaboration diagram for QOpenGLShaderProgram:

Public Member Functions

 QOpenGLShaderProgram (QObject *parent=nullptr)
 Constructs a new shader program and attaches it to parent.
 ~QOpenGLShaderProgram ()
 Deletes this shader program.
bool addShader (QOpenGLShader *shader)
 Adds a compiled shader to this shader program.
void removeShader (QOpenGLShader *shader)
 Removes shader from this shader program.
QList< QOpenGLShader * > shaders () const
 Returns a list of all shaders that have been added to this shader program using addShader().
bool addShaderFromSourceCode (QOpenGLShader::ShaderType type, const char *source)
 Compiles source as a shader of the specified type and adds it to this shader program.
bool addShaderFromSourceCode (QOpenGLShader::ShaderType type, const QByteArray &source)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compiles source as a shader of the specified type and adds it to this shader program.
bool addShaderFromSourceCode (QOpenGLShader::ShaderType type, const QString &source)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compiles source as a shader of the specified type and adds it to this shader program.
bool 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.
bool addCacheableShaderFromSourceCode (QOpenGLShader::ShaderType type, const char *source)
 Registers the shader of the specified type and source to this program.
bool addCacheableShaderFromSourceCode (QOpenGLShader::ShaderType type, const QByteArray &source)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Registers the shader of the specified type and source to this program.
bool addCacheableShaderFromSourceCode (QOpenGLShader::ShaderType type, const QString &source)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Registers the shader of the specified type and source to this program.
bool addCacheableShaderFromSourceFile (QOpenGLShader::ShaderType type, const QString &fileName)
 Registers the shader of the specified type and fileName to this program.
void removeAllShaders ()
 Removes all of the shaders that were added to this program previously.
virtual bool link ()
 Links together the shaders that were added to this program with addShader().
bool isLinked () const
 Returns true if this shader program has been linked; false otherwise.
QString log () const
 Returns the errors and warnings that occurred during the last link() or addShader() with explicitly specified source code.
bool bind ()
 Binds this shader program to the active QOpenGLContext and makes it the current shader program.
void release ()
 Releases the active shader program from the current QOpenGLContext.
bool create ()
 Requests the shader program's id to be created immediately.
GLuint programId () const
 Returns the OpenGL identifier associated with this shader program.
int maxGeometryOutputVertices () const
 Returns the hardware limit for how many vertices a geometry shader can output.
void setPatchVertexCount (int count)
 Use this function to specify to OpenGL the number of vertices in a patch to count.
int patchVertexCount () const
 Returns the number of vertices per-patch to be used when rendering.
void setDefaultOuterTessellationLevels (const QList< 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.
QList< float > defaultOuterTessellationLevels () const
 Returns 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.
void setDefaultInnerTessellationLevels (const QList< 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.
QList< float > defaultInnerTessellationLevels () const
 Returns the default inner tessellation levels to be used by the tessellation primitive generator in the event that the tessellation control shader does not output them.
void bindAttributeLocation (const char *name, int location)
 Binds the attribute name to the specified location.
void bindAttributeLocation (const QByteArray &name, int location)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Binds the attribute name to the specified location.
void bindAttributeLocation (const QString &name, int location)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Binds the attribute name to the specified location.
int attributeLocation (const char *name) const
 Returns the location of the attribute name within this shader program's parameter list.
int attributeLocation (const QByteArray &name) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the location of the attribute name within this shader program's parameter list.
int attributeLocation (const QString &name) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the location of the attribute name within this shader program's parameter list.
void setAttributeValue (int location, GLfloat value)
 Sets the attribute at location in the current context to value.
void setAttributeValue (int location, GLfloat x, GLfloat y)
 Sets the attribute at location in the current context to the 2D vector (x, y).
void 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 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 setAttributeValue (int location, const QVector2D &value)
 Sets the attribute at location in the current context to value.
void setAttributeValue (int location, const QVector3D &value)
 Sets the attribute at location in the current context to value.
void setAttributeValue (int location, const QVector4D &value)
 Sets the attribute at location in the current context to value.
void setAttributeValue (int location, const QColor &value)
 Sets the attribute at location in the current context to value.
void 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.
void setAttributeValue (const char *name, GLfloat value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to value.
void setAttributeValue (const char *name, GLfloat x, GLfloat y)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to the 2D vector (x, y).
void setAttributeValue (const char *name, GLfloat x, GLfloat y, GLfloat z)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to the 3D vector (x, y, z).
void setAttributeValue (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to the 4D vector (x, y, z, w).
void setAttributeValue (const char *name, const QVector2D &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to value.
void setAttributeValue (const char *name, const QVector3D &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to value.
void setAttributeValue (const char *name, const QVector4D &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to value.
void setAttributeValue (const char *name, const QColor &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to value.
void setAttributeValue (const char *name, const GLfloat *values, int columns, int rows)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to the contents of values, which contains columns elements, each consisting of rows elements.
void 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.
void 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.
void 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.
void 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.
void 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.
void setAttributeArray (const char *name, const GLfloat *values, int tupleSize, int stride=0)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets an array of vertex values on the attribute called name in this shader program.
void setAttributeArray (const char *name, const QVector2D *values, int stride=0)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets an array of 2D vertex values on the attribute called name in this shader program.
void setAttributeArray (const char *name, const QVector3D *values, int stride=0)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets an array of 3D vertex values on the attribute called name in this shader program.
void setAttributeArray (const char *name, const QVector4D *values, int stride=0)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets an array of 4D vertex values on the attribute called name in this shader program.
void setAttributeArray (const char *name, GLenum type, const void *values, int tupleSize, int stride=0)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets an array of vertex values on the attribute called name in this shader program.
void 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.
void setAttributeBuffer (const char *name, GLenum type, int offset, int tupleSize, int stride=0)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.
void 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.
void enableAttributeArray (const char *name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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 disableAttributeArray (int location)
 Disables the vertex array at location in this shader program that was enabled by a previous call to enableAttributeArray().
void disableAttributeArray (const char *name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Disables the vertex array called name in this shader program that was enabled by a previous call to enableAttributeArray().
int uniformLocation (const char *name) const
 Returns the location of the uniform variable name within this shader program's parameter list.
int uniformLocation (const QByteArray &name) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the location of the uniform variable name within this shader program's parameter list.
int uniformLocation (const QString &name) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the location of the uniform variable name within this shader program's parameter list.
void setUniformValue (int location, GLfloat value)
 Sets the uniform variable at location in the current context to value.
void setUniformValue (int location, GLint value)
 Sets the uniform variable at location in the current context to value.
void setUniformValue (int location, GLuint value)
 Sets the uniform variable at location in the current context to value.
void setUniformValue (int location, GLfloat x, GLfloat y)
 Sets the uniform variable at location in the current context to the 2D vector (x, y).
void 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 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 setUniformValue (int location, const QVector2D &value)
 Sets the uniform variable at location in the current context to value.
void setUniformValue (int location, const QVector3D &value)
 Sets the uniform variable at location in the current context to value.
void setUniformValue (int location, const QVector4D &value)
 Sets the uniform variable at location in the current context to value.
void 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 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 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 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 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 setUniformValue (int location, const QMatrix2x2 &value)
 Sets the uniform variable at location in the current context to a 2x2 matrix value.
void setUniformValue (int location, const QMatrix2x3 &value)
 Sets the uniform variable at location in the current context to a 2x3 matrix value.
void setUniformValue (int location, const QMatrix2x4 &value)
 Sets the uniform variable at location in the current context to a 2x4 matrix value.
void setUniformValue (int location, const QMatrix3x2 &value)
 Sets the uniform variable at location in the current context to a 3x2 matrix value.
void setUniformValue (int location, const QMatrix3x3 &value)
 Sets the uniform variable at location in the current context to a 3x3 matrix value.
void setUniformValue (int location, const QMatrix3x4 &value)
 Sets the uniform variable at location in the current context to a 3x4 matrix value.
void setUniformValue (int location, const QMatrix4x2 &value)
 Sets the uniform variable at location in the current context to a 4x2 matrix value.
void setUniformValue (int location, const QMatrix4x3 &value)
 Sets the uniform variable at location in the current context to a 4x3 matrix value.
void setUniformValue (int location, const QMatrix4x4 &value)
 Sets the uniform variable at location in the current context to a 4x4 matrix value.
void setUniformValue (int location, const GLfloat value[2][2])
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable at location in the current context to a 2x2 matrix value.
void setUniformValue (int location, const GLfloat value[3][3])
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable at location in the current context to a 3x3 matrix value.
void setUniformValue (int location, const GLfloat value[4][4])
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable at location in the current context to a 4x4 matrix value.
void 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.
void setUniformValue (const char *name, GLfloat value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to value.
void setUniformValue (const char *name, GLint value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to value.
void setUniformValue (const char *name, GLuint value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to value.
void setUniformValue (const char *name, GLfloat x, GLfloat y)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to the 2D vector (x, y).
void setUniformValue (const char *name, GLfloat x, GLfloat y, GLfloat z)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to the 3D vector (x, y, z).
void setUniformValue (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to the 4D vector (x, y, z, w).
void setUniformValue (const char *name, const QVector2D &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to value.
void setUniformValue (const char *name, const QVector3D &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to value.
void setUniformValue (const char *name, const QVector4D &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to value.
void setUniformValue (const char *name, const QColor &color)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to the red, green, blue, and alpha components of color.
void setUniformValue (const char *name, const QPoint &point)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable associated with name in the current context to the x and y coordinates of point.
void setUniformValue (const char *name, const QPointF &point)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable associated with name in the current context to the x and y coordinates of point.
void setUniformValue (const char *name, const QSize &size)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable associated with name in the current context to the width and height of the given size.
void setUniformValue (const char *name, const QSizeF &size)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable associated with name in the current context to the width and height of the given size.
void setUniformValue (const char *name, const QMatrix2x2 &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 2x2 matrix value.
void setUniformValue (const char *name, const QMatrix2x3 &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 2x3 matrix value.
void setUniformValue (const char *name, const QMatrix2x4 &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 2x4 matrix value.
void setUniformValue (const char *name, const QMatrix3x2 &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 3x2 matrix value.
void setUniformValue (const char *name, const QMatrix3x3 &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 3x3 matrix value.
void setUniformValue (const char *name, const QMatrix3x4 &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 3x4 matrix value.
void setUniformValue (const char *name, const QMatrix4x2 &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 4x2 matrix value.
void setUniformValue (const char *name, const QMatrix4x3 &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 4x3 matrix value.
void setUniformValue (const char *name, const QMatrix4x4 &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 4x4 matrix value.
void setUniformValue (const char *name, const GLfloat value[2][2])
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 2x2 matrix value.
void setUniformValue (const char *name, const GLfloat value[3][3])
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 3x3 matrix value.
void setUniformValue (const char *name, const GLfloat value[4][4])
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 4x4 matrix value.
void setUniformValue (const char *name, const QTransform &value)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 3x3 transformation matrix value that is specified as a QTransform value.
void 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.
void 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 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.
void 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 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 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.
void 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 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 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 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 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 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 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 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 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 setUniformValueArray (const char *name, const GLfloat *values, int count, int tupleSize)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count elements of values.
void setUniformValueArray (const char *name, const GLint *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count elements of values.
void setUniformValueArray (const char *name, const GLuint *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count elements of values.
void setUniformValueArray (const char *name, const QVector2D *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 2D vector elements of values.
void setUniformValueArray (const char *name, const QVector3D *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 3D vector elements of values.
void setUniformValueArray (const char *name, const QVector4D *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 4D vector elements of values.
void setUniformValueArray (const char *name, const QMatrix2x2 *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 2x2 matrix elements of values.
void setUniformValueArray (const char *name, const QMatrix2x3 *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 2x3 matrix elements of values.
void setUniformValueArray (const char *name, const QMatrix2x4 *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 2x4 matrix elements of values.
void setUniformValueArray (const char *name, const QMatrix3x2 *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 3x2 matrix elements of values.
void setUniformValueArray (const char *name, const QMatrix3x3 *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 3x3 matrix elements of values.
void setUniformValueArray (const char *name, const QMatrix3x4 *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 3x4 matrix elements of values.
void setUniformValueArray (const char *name, const QMatrix4x2 *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 4x2 matrix elements of values.
void setUniformValueArray (const char *name, const QMatrix4x3 *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 4x3 matrix elements of values.
void setUniformValueArray (const char *name, const QMatrix4x4 *values, int count)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 4x4 matrix elements of values.
Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
virtual bool event (QEvent *event)
 This virtual function receives events to an object and should return true if the event e was recognized and processed.
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
QString objectName () const
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
QBindable< QStringbindableObjectName ()
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
bool isQmlExposed () const noexcept
 Returns whether the object has been created by the QML engine or ownership has been explicitly set via QJSEngine::setObjectOwnership().
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
QThreadthread () const
 Returns the thread in which the object lives.
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
void killTimer (int id)
 Kills the timer with timer identifier, id.
void killTimer (Qt::TimerId id)
template<typename T>
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
template<typename T>
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
template<typename T>
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<typename T>
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
const QObjectListchildren () const
 Returns a list of child objects.
void setParent (QObject *parent)
 Makes the object a child of parent.
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
bool disconnect (const QObject *receiver, const char *member=nullptr) const
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
bool setProperty (const char *name, QVariant &&value)
QVariant property (const char *name) const
 Returns the value of the object's name property.
QList< QByteArraydynamicPropertyNames () const
QBindingStoragebindingStorage ()
const QBindingStoragebindingStorage () const
QObjectparent () const
 Returns a pointer to the parent object.
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.

Static Public Member Functions

static bool hasOpenGLShaderPrograms (QOpenGLContext *context=nullptr)
 Returns true if shader programs written in the OpenGL Shading Language (GLSL) are supported on this system; false otherwise.
Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
template<typename Func1, typename Func2>
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
template<typename Func1, typename Func2>
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
template<typename Func1, typename Func2>
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
template<typename Func1>
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)

Additional Inherited Members

Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
int senderSignalIndex () const
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
bool isSignalConnected (const QMetaMethod &signal) const
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
virtual void connectNotify (const QMetaMethod &signal)
virtual void disconnectNotify (const QMetaMethod &signal)
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
Properties inherited from QObject
QString objectName
 the name of this object

Detailed Description

The QOpenGLShaderProgram class allows OpenGL shader programs to be linked and used.

Since
5.0

\inmodule QtOpenGL

Definition at line 70 of file qopenglshaderprogram.h.

Constructor & Destructor Documentation

◆ QOpenGLShaderProgram()

QOpenGLShaderProgram::QOpenGLShaderProgram ( QObject * parent = nullptr)
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.

See also
addShader()

Definition at line 843 of file qopenglshaderprogram.cpp.

◆ ~QOpenGLShaderProgram()

QOpenGLShaderProgram::~QOpenGLShaderProgram ( )

Deletes this shader program.

Definition at line 851 of file qopenglshaderprogram.cpp.

Member Function Documentation

◆ addCacheableShaderFromSourceCode() [1/3]

bool QOpenGLShaderProgram::addCacheableShaderFromSourceCode ( QOpenGLShader::ShaderType type,
const char * source )

Registers the shader of the specified type and source to this program.

Unlike addShaderFromSourceCode(), this function does not perform compilation. Compilation is deferred to link(), and may not happen at all, because link() may potentially use a program binary from Qt's shader disk cache. This will typically lead to a significant increase in performance.

Returns
true if the shader has been registered or, in the non-cached case, compiled successfully; false if there was an error. The compilation error messages can be retrieved via log().

When the disk cache is disabled, via Qt::AA_DisableShaderDiskCache for example, or the OpenGL context has no support for context binaries, calling this function is equivalent to addShaderFromSourceCode().

Since
5.9
See also
addShaderFromSourceCode(), addCacheableShaderFromSourceFile()

Definition at line 1054 of file qopenglshaderprogram.cpp.

◆ addCacheableShaderFromSourceCode() [2/3]

bool QOpenGLShaderProgram::addCacheableShaderFromSourceCode ( QOpenGLShader::ShaderType type,
const QByteArray & source )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Registers the shader of the specified type and source to this program.

Unlike addShaderFromSourceCode(), this function does not perform compilation. Compilation is deferred to link(), and may not happen at all, because link() may potentially use a program binary from Qt's shader disk cache. This will typically lead to a significant increase in performance.

Returns
true if the shader has been registered or, in the non-cached case, compiled successfully; false if there was an error. The compilation error messages can be retrieved via log().

When the disk cache is disabled, via Qt::AA_DisableShaderDiskCache for example, or the OpenGL context has no support for context binaries, calling this function is equivalent to addShaderFromSourceCode().

Since
5.9
See also
addShaderFromSourceCode(), addCacheableShaderFromSourceFile()

Definition at line 1123 of file qopenglshaderprogram.cpp.

◆ addCacheableShaderFromSourceCode() [3/3]

bool QOpenGLShaderProgram::addCacheableShaderFromSourceCode ( QOpenGLShader::ShaderType type,
const QString & source )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Registers the shader of the specified type and source to this program.

Unlike addShaderFromSourceCode(), this function does not perform compilation. Compilation is deferred to link(), and may not happen at all, because link() may potentially use a program binary from Qt's shader disk cache. This will typically lead to a significant increase in performance.

When the disk cache is disabled, via Qt::AA_DisableShaderDiskCache for example, or the OpenGL context has no support for context binaries, calling this function is equivalent to addShaderFromSourceCode().

Since
5.9
See also
addShaderFromSourceCode(), addCacheableShaderFromSourceFile()

Definition at line 1151 of file qopenglshaderprogram.cpp.

◆ addCacheableShaderFromSourceFile()

bool QOpenGLShaderProgram::addCacheableShaderFromSourceFile ( QOpenGLShader::ShaderType type,
const QString & fileName )

Registers the shader of the specified type and fileName to this program.

Unlike addShaderFromSourceFile(), this function does not perform compilation. Compilation is deferred to link(), and may not happen at all, because link() may potentially use a program binary from Qt's shader disk cache. This will typically lead to a significant increase in performance.

Returns
true if the file has been read successfully, false if the file could not be opened or the normal, non-cached compilation of the shader has failed. The compilation error messages can be retrieved via log().

When the disk cache is disabled, via Qt::AA_DisableShaderDiskCache for example, or the OpenGL context has no support for context binaries, calling this function is equivalent to addShaderFromSourceFile().

Since
5.9
See also
addShaderFromSourceFile(), addCacheableShaderFromSourceCode()

Definition at line 1180 of file qopenglshaderprogram.cpp.

◆ addShader()

bool QOpenGLShaderProgram::addShader ( QOpenGLShader * shader)

Adds a compiled shader to this shader program.

Returns true if the shader could be added, or false otherwise.

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.

See also
addShaderFromSourceCode(), addShaderFromSourceFile()
removeShader(), link(), removeAllShaders()

Definition at line 916 of file qopenglshaderprogram.cpp.

◆ addShaderFromSourceCode() [1/3]

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, false otherwise. The compilation errors and warnings will be made available via log().

This function is intended to be a short-cut for quickly adding vertex and fragment shaders to a shader program without creating an instance of QOpenGLShader first.

See also
addShader(), addShaderFromSourceFile()
removeShader(), link(), log(), removeAllShaders()

Definition at line 953 of file qopenglshaderprogram.cpp.

◆ addShaderFromSourceCode() [2/3]

bool QOpenGLShaderProgram::addShaderFromSourceCode ( QOpenGLShader::ShaderType type,
const QByteArray & source )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compiles source as a shader of the specified type and adds it to this shader program.

Returns true if compilation was successful, false otherwise. The compilation errors and warnings will be made available via log().

This function is intended to be a short-cut for quickly adding vertex and fragment shaders to a shader program without creating an instance of QOpenGLShader first.

See also
addShader(), addShaderFromSourceFile()
removeShader(), link(), log(), removeAllShaders()

Definition at line 983 of file qopenglshaderprogram.cpp.

◆ addShaderFromSourceCode() [3/3]

bool QOpenGLShaderProgram::addShaderFromSourceCode ( QOpenGLShader::ShaderType type,
const QString & source )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Compiles source as a shader of the specified type and adds it to this shader program.

Returns true if compilation was successful, false otherwise. The compilation errors and warnings will be made available via log().

This function is intended to be a short-cut for quickly adding vertex and fragment shaders to a shader program without creating an instance of QOpenGLShader first.

See also
addShader(), addShaderFromSourceFile()
removeShader(), link(), log(), removeAllShaders()

Definition at line 1003 of file qopenglshaderprogram.cpp.

◆ addShaderFromSourceFile()

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, false otherwise. The compilation errors and warnings will be made available via log().

This function is intended to be a short-cut for quickly adding vertex and fragment shaders to a shader program without creating an instance of QOpenGLShader first.

See also
addShader(), addShaderFromSourceCode()

Definition at line 1020 of file qopenglshaderprogram.cpp.

◆ attributeLocation() [1/3]

int QOpenGLShaderProgram::attributeLocation ( const char * name) const

Returns the location of the attribute name within this shader program's parameter list.

Returns -1 if name is not a valid attribute for this shader program.

See also
uniformLocation(), bindAttributeLocation()

Definition at line 1493 of file qopenglshaderprogram.cpp.

◆ attributeLocation() [2/3]

int QOpenGLShaderProgram::attributeLocation ( const QByteArray & name) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the location of the attribute name within this shader program's parameter list.

Returns -1 if name is not a valid attribute for this shader program.

See also
uniformLocation(), bindAttributeLocation()

Definition at line 1513 of file qopenglshaderprogram.cpp.

◆ attributeLocation() [3/3]

int QOpenGLShaderProgram::attributeLocation ( const QString & name) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the location of the attribute name within this shader program's parameter list.

Returns -1 if name is not a valid attribute for this shader program.

See also
uniformLocation(), bindAttributeLocation()

Definition at line 1527 of file qopenglshaderprogram.cpp.

◆ bind()

bool QOpenGLShaderProgram::bind ( )

Binds this shader program to the active QOpenGLContext and makes it the current shader program.

Any previously bound shader program is released. This is equivalent to calling {glUseProgram()} on programId(). Returns true if the program was successfully bound; false otherwise. If the shader program has not yet been linked, or it needs to be re-linked, this function will call link().

See also
link(), release()

Definition at line 1376 of file qopenglshaderprogram.cpp.

◆ bindAttributeLocation() [1/3]

void QOpenGLShaderProgram::bindAttributeLocation ( const char * name,
int location )

Binds the attribute name to the specified location.

This function 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.

When this function is called after the program has been linked, the program will need to be relinked for the change to take effect.

See also
attributeLocation()

Definition at line 1441 of file qopenglshaderprogram.cpp.

◆ bindAttributeLocation() [2/3]

void QOpenGLShaderProgram::bindAttributeLocation ( const QByteArray & name,
int location )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Binds the attribute name to the specified location.

This function 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.

When this function is called after the program has been linked, the program will need to be relinked for the change to take effect.

See also
attributeLocation()

Definition at line 1463 of file qopenglshaderprogram.cpp.

◆ bindAttributeLocation() [3/3]

void QOpenGLShaderProgram::bindAttributeLocation ( const QString & name,
int location )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Binds the attribute name to the specified location.

This function 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.

When this function is called after the program has been linked, the program will need to be relinked for the change to take effect.

See also
attributeLocation()

Definition at line 1481 of file qopenglshaderprogram.cpp.

◆ create()

bool QOpenGLShaderProgram::create ( )

Requests the shader program's id to be created immediately.

Returns true if successful; false otherwise.

This function 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.

See also
programId()
Since
5.3

Definition at line 870 of file qopenglshaderprogram.cpp.

◆ defaultInnerTessellationLevels()

QList< float > QOpenGLShaderProgram::defaultInnerTessellationLevels ( ) const

Returns the default inner tessellation levels to be used by the tessellation primitive generator in the event that the tessellation control shader does not output them.

For more details on OpenGL and Tessellation shaders see \l{OpenGL Tessellation Shaders}.

Returns a QList of floats describing the inner tessellation levels. The vector will always have two elements but not all of them make sense for every mode of tessellation.

Note
This returns the global OpenGL state value. It is not specific to this QOpenGLShaderProgram instance.
This function is only supported with OpenGL >= 4.0 and will not return valid results with OpenGL ES 3.2.
See also
setDefaultInnerTessellationLevels(), defaultOuterTessellationLevels()

Definition at line 3670 of file qopenglshaderprogram.cpp.

◆ defaultOuterTessellationLevels()

QList< float > QOpenGLShaderProgram::defaultOuterTessellationLevels ( ) const

Returns 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.

For more details on OpenGL and Tessellation shaders see \l{OpenGL Tessellation Shaders}.

Returns a QList of floats describing the outer tessellation levels. The vector will always have four elements but not all of them make sense for every mode of tessellation.

Note
This returns the global OpenGL state value. It is not specific to this QOpenGLShaderProgram instance.
This function is only supported with OpenGL >= 4.0 and will not return valid results with OpenGL ES 3.2.
See also
setDefaultOuterTessellationLevels(), defaultInnerTessellationLevels()

Definition at line 3597 of file qopenglshaderprogram.cpp.

◆ disableAttributeArray() [1/2]

void QOpenGLShaderProgram::disableAttributeArray ( const char * name)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Disables the vertex array called name in this shader program that was enabled by a previous call to enableAttributeArray().

See also
enableAttributeArray(), setAttributeArray(), setAttributeValue()
setUniformValue()

Definition at line 2155 of file qopenglshaderprogram.cpp.

◆ disableAttributeArray() [2/2]

void QOpenGLShaderProgram::disableAttributeArray ( int location)

Disables the vertex array at location in this shader program that was enabled by a previous call to enableAttributeArray().

See also
enableAttributeArray(), setAttributeArray(), setAttributeValue()
setUniformValue()

Definition at line 2138 of file qopenglshaderprogram.cpp.

◆ enableAttributeArray() [1/2]

void QOpenGLShaderProgram::enableAttributeArray ( const char * name)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

See also
disableAttributeArray(), setAttributeArray(), setAttributeValue()
setUniformValue()

Definition at line 2126 of file qopenglshaderprogram.cpp.

◆ enableAttributeArray() [2/2]

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.

See also
disableAttributeArray(), setAttributeArray(), setAttributeValue()
setUniformValue()

Definition at line 2108 of file qopenglshaderprogram.cpp.

◆ hasOpenGLShaderPrograms()

bool QOpenGLShaderProgram::hasOpenGLShaderPrograms ( QOpenGLContext * context = nullptr)
static

Returns true if shader programs written in the OpenGL Shading Language (GLSL) are supported on this system; false otherwise.

The context is used to resolve the GLSL extensions. If context is \nullptr, then QOpenGLContext::currentContext() is used.

Definition at line 3692 of file qopenglshaderprogram.cpp.

◆ isLinked()

bool QOpenGLShaderProgram::isLinked ( ) const

Returns true if this shader program has been linked; false otherwise.

See also
link()

Definition at line 1348 of file qopenglshaderprogram.cpp.

◆ link()

bool QOpenGLShaderProgram::link ( )
virtual

Links together the shaders that were added to this program with addShader().

Returns true if the link was successful or false otherwise. If the link failed, the error messages can be retrieved with log().

Subclasses can override this function to initialize attributes and uniform variables for use in specific shader programs.

If the shader program was already linked, calling this function again will force it to be re-linked.

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, link() 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.

See also
addShader(), log()

Definition at line 1294 of file qopenglshaderprogram.cpp.

◆ log()

QString QOpenGLShaderProgram::log ( ) const

Returns the errors and warnings that occurred during the last link() or addShader() with explicitly specified source code.

See also
link()

Definition at line 1360 of file qopenglshaderprogram.cpp.

◆ maxGeometryOutputVertices()

int QOpenGLShaderProgram::maxGeometryOutputVertices ( ) const

Returns the hardware limit for how many vertices a geometry shader can output.

Definition at line 3489 of file qopenglshaderprogram.cpp.

◆ patchVertexCount()

int QOpenGLShaderProgram::patchVertexCount ( ) const

Returns the number of vertices per-patch to be used when rendering.

Note
This returns the global OpenGL state value. It is not specific to this QOpenGLShaderProgram instance.
See also
setPatchVertexCount()

Definition at line 3529 of file qopenglshaderprogram.cpp.

◆ programId()

GLuint QOpenGLShaderProgram::programId ( ) const

Returns the OpenGL identifier associated with this shader program.

See also
QOpenGLShader::shaderId()

Definition at line 1415 of file qopenglshaderprogram.cpp.

◆ release()

void QOpenGLShaderProgram::release ( )

Releases the active shader program from the current QOpenGLContext.

This is equivalent to calling {glUseProgram(0)}.

See also
bind()

Definition at line 1400 of file qopenglshaderprogram.cpp.

◆ removeAllShaders()

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.

See also
addShader(), removeShader()

Definition at line 1250 of file qopenglshaderprogram.cpp.

◆ removeShader()

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.

See also
addShader(), link(), removeAllShaders()

Definition at line 1214 of file qopenglshaderprogram.cpp.

◆ setAttributeArray() [1/10]

void QOpenGLShaderProgram::setAttributeArray ( const char * name,
const GLfloat * values,
int tupleSize,
int stride = 0 )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

See also
setAttributeValue(), setUniformValue(), enableAttributeArray()
disableAttributeArray()

Definition at line 1945 of file qopenglshaderprogram.cpp.

◆ setAttributeArray() [2/10]

void QOpenGLShaderProgram::setAttributeArray ( const char * name,
const QVector2D * values,
int stride = 0 )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

See also
setAttributeValue(), setUniformValue(), enableAttributeArray()
disableAttributeArray()

Definition at line 1966 of file qopenglshaderprogram.cpp.

◆ setAttributeArray() [3/10]

void QOpenGLShaderProgram::setAttributeArray ( const char * name,
const QVector3D * values,
int stride = 0 )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

See also
setAttributeValue(), setUniformValue(), enableAttributeArray()
disableAttributeArray()

Definition at line 1987 of file qopenglshaderprogram.cpp.

◆ setAttributeArray() [4/10]

void QOpenGLShaderProgram::setAttributeArray ( const char * name,
const QVector4D * values,
int stride = 0 )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

See also
setAttributeValue(), setUniformValue(), enableAttributeArray()
disableAttributeArray()

Definition at line 2008 of file qopenglshaderprogram.cpp.

◆ setAttributeArray() [5/10]

void QOpenGLShaderProgram::setAttributeArray ( const char * name,
GLenum type,
const void * values,
int tupleSize,
int stride = 0 )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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() function can be used to set the attribute array to an offset within a vertex buffer.

See also
setAttributeValue(), setUniformValue(), enableAttributeArray()
disableAttributeArray(), setAttributeBuffer()

Definition at line 2036 of file qopenglshaderprogram.cpp.

◆ setAttributeArray() [6/10]

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.

See also
setAttributeValue(), setUniformValue(), enableAttributeArray()
disableAttributeArray()

Definition at line 1812 of file qopenglshaderprogram.cpp.

◆ setAttributeArray() [7/10]

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.

See also
setAttributeValue(), setUniformValue(), enableAttributeArray()
disableAttributeArray()

Definition at line 1836 of file qopenglshaderprogram.cpp.

◆ setAttributeArray() [8/10]

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.

See also
setAttributeValue(), setUniformValue(), enableAttributeArray()
disableAttributeArray()

Definition at line 1860 of file qopenglshaderprogram.cpp.

◆ setAttributeArray() [9/10]

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.

See also
setAttributeValue(), setUniformValue(), enableAttributeArray()
disableAttributeArray()

Definition at line 1884 of file qopenglshaderprogram.cpp.

◆ setAttributeArray() [10/10]

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() function can be used to set the attribute array to an offset within a vertex buffer.

Note
Normalization will be enabled. If this is not desired, call glVertexAttribPointer directly through QOpenGLFunctions.
See also
setAttributeValue(), setUniformValue(), enableAttributeArray()
disableAttributeArray(), setAttributeBuffer()

Definition at line 1918 of file qopenglshaderprogram.cpp.

◆ setAttributeBuffer() [1/2]

void QOpenGLShaderProgram::setAttributeBuffer ( const char * name,
GLenum type,
int offset,
int tupleSize,
int stride = 0 )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

See also
setAttributeArray()

Definition at line 2094 of file qopenglshaderprogram.cpp.

◆ setAttributeBuffer() [2/2]

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.

Note
Normalization will be enabled. If this is not desired, call glVertexAttribPointer directly through QOpenGLFunctions.
See also
setAttributeArray()

Definition at line 2063 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [1/18]

void QOpenGLShaderProgram::setAttributeValue ( const char * name,
const GLfloat * values,
int columns,
int rows )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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 function is typically used to set matrix values and column vectors.

See also
setUniformValue()

Definition at line 1792 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [2/18]

void QOpenGLShaderProgram::setAttributeValue ( const char * name,
const QColor & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to value.

See also
setUniformValue()

Definition at line 1742 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [3/18]

void QOpenGLShaderProgram::setAttributeValue ( const char * name,
const QVector2D & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to value.

See also
setUniformValue()

Definition at line 1664 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [4/18]

void QOpenGLShaderProgram::setAttributeValue ( const char * name,
const QVector3D & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to value.

See also
setUniformValue()

Definition at line 1689 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [5/18]

void QOpenGLShaderProgram::setAttributeValue ( const char * name,
const QVector4D & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to value.

See also
setUniformValue()

Definition at line 1714 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [6/18]

void QOpenGLShaderProgram::setAttributeValue ( const char * name,
GLfloat value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to value.

See also
setUniformValue()

Definition at line 1551 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [7/18]

void QOpenGLShaderProgram::setAttributeValue ( const char * name,
GLfloat x,
GLfloat y )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to the 2D vector (x, y).

See also
setUniformValue()

Definition at line 1579 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [8/18]

void QOpenGLShaderProgram::setAttributeValue ( const char * name,
GLfloat x,
GLfloat y,
GLfloat z )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to the 3D vector (x, y, z).

See also
setUniformValue()

Definition at line 1609 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [9/18]

void QOpenGLShaderProgram::setAttributeValue ( const char * name,
GLfloat x,
GLfloat y,
GLfloat z,
GLfloat w )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the attribute called name in the current context to the 4D vector (x, y, z, w).

See also
setUniformValue()

Definition at line 1639 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [10/18]

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 function is typically used to set matrix values and column vectors.

See also
setUniformValue()

Definition at line 1756 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [11/18]

void QOpenGLShaderProgram::setAttributeValue ( int location,
const QColor & value )

Sets the attribute at location in the current context to value.

See also
setUniformValue()

Definition at line 1724 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [12/18]

void QOpenGLShaderProgram::setAttributeValue ( int location,
const QVector2D & value )

Sets the attribute at location in the current context to value.

See also
setUniformValue()

Definition at line 1650 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [13/18]

void QOpenGLShaderProgram::setAttributeValue ( int location,
const QVector3D & value )

Sets the attribute at location in the current context to value.

See also
setUniformValue()

Definition at line 1674 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [14/18]

void QOpenGLShaderProgram::setAttributeValue ( int location,
const QVector4D & value )

Sets the attribute at location in the current context to value.

See also
setUniformValue()

Definition at line 1699 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [15/18]

void QOpenGLShaderProgram::setAttributeValue ( int location,
GLfloat value )

Sets the attribute at location in the current context to value.

See also
setUniformValue()

Definition at line 1537 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [16/18]

void QOpenGLShaderProgram::setAttributeValue ( int location,
GLfloat x,
GLfloat y )

Sets the attribute at location in the current context to the 2D vector (x, y).

See also
setUniformValue()

Definition at line 1562 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [17/18]

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).

See also
setUniformValue()

Definition at line 1590 of file qopenglshaderprogram.cpp.

◆ setAttributeValue() [18/18]

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).

See also
setUniformValue()

Definition at line 1621 of file qopenglshaderprogram.cpp.

◆ setDefaultInnerTessellationLevels()

void QOpenGLShaderProgram::setDefaultInnerTessellationLevels ( const QList< 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 \l{OpenGL Tessellation Shaders}.

The levels argument should be a QList 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.

Note
This modifies global OpenGL state and is not specific to this QOpenGLShaderProgram instance. You should call this in your render function when needed, as QOpenGLShaderProgram will not apply this for you. This is purely a convenience function.
This function is only available with OpenGL >= 4.0 and is not supported with OpenGL ES 3.2.
See also
defaultInnerTessellationLevels(), setDefaultOuterTessellationLevels()

Definition at line 3630 of file qopenglshaderprogram.cpp.

◆ setDefaultOuterTessellationLevels()

void QOpenGLShaderProgram::setDefaultOuterTessellationLevels ( const QList< 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 \l{OpenGL Tessellation Shaders}.

The levels argument should be a QList 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.

Note
This modifies global OpenGL state and is not specific to this QOpenGLShaderProgram instance. You should call this in your render function when needed, as QOpenGLShaderProgram will not apply this for you. This is purely a convenience function.
This function is only available with OpenGL >= 4.0 and is not supported with OpenGL ES 3.2.
See also
defaultOuterTessellationLevels(), setDefaultInnerTessellationLevels()

Definition at line 3557 of file qopenglshaderprogram.cpp.

◆ setPatchVertexCount()

void QOpenGLShaderProgram::setPatchVertexCount ( int count)

Use this function 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 function 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}.

This is equivalent to calling glPatchParameteri(GL_PATCH_VERTICES, count).

Note
This modifies global OpenGL state and is not specific to this QOpenGLShaderProgram instance. You should call this in your render function when needed, as QOpenGLShaderProgram will not apply this for you. This is purely a convenience function.
See also
patchVertexCount()

Definition at line 3515 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [1/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const GLfloat value[2][2] )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

See also
setAttributeValue()

Definition at line 2950 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [2/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const GLfloat value[3][3] )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

See also
setAttributeValue()

Definition at line 2964 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [3/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const GLfloat value[4][4] )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

See also
setAttributeValue()

Definition at line 2978 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [4/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QColor & color )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to the red, green, blue, and alpha components of color.

See also
setAttributeValue()

Definition at line 2486 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [5/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QMatrix2x2 & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 2x2 matrix value.

See also
setAttributeValue()

Definition at line 2628 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [6/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QMatrix2x3 & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 2x3 matrix value.

Note
This function is not aware of non square matrix support, that is, GLSL types like mat2x3, that is present in modern OpenGL versions. Instead, it treats the uniform as an array of vec3.
See also
setAttributeValue()

Definition at line 2662 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [7/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QMatrix2x4 & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 2x4 matrix value.

Note
This function is not aware of non square matrix support, that is, GLSL types like mat2x4, that is present in modern OpenGL versions. Instead, it treats the uniform as an array of vec4.
See also
setAttributeValue()

Definition at line 2696 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [8/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QMatrix3x2 & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 3x2 matrix value.

Note
This function is not aware of non square matrix support, that is, GLSL types like mat3x2, that is present in modern OpenGL versions. Instead, it treats the uniform as an array of vec2.
See also
setAttributeValue()

Definition at line 2730 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [9/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QMatrix3x3 & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 3x3 matrix value.

See also
setAttributeValue()

Definition at line 2756 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [10/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QMatrix3x4 & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 3x4 matrix value.

Note
This function is not aware of non square matrix support, that is, GLSL types like mat3x4, that is present in modern OpenGL versions. Instead, it treats the uniform as an array of vec4.
See also
setAttributeValue()

Definition at line 2790 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [11/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QMatrix4x2 & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 4x2 matrix value.

Note
This function is not aware of non square matrix support, that is, GLSL types like mat4x2, that is present in modern OpenGL versions. Instead, it treats the uniform as an array of vec2.
See also
setAttributeValue()

Definition at line 2824 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [12/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QMatrix4x3 & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 4x3 matrix value.

Note
This function is not aware of non square matrix support, that is, GLSL types like mat4x3, that is present in modern OpenGL versions. Instead, it treats the uniform as an array of vec3.
See also
setAttributeValue()

Definition at line 2858 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [13/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QMatrix4x4 & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to a 4x4 matrix value.

See also
setAttributeValue()

Definition at line 2884 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [14/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QPoint & point )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable associated with name in the current context to the x and y coordinates of point.

See also
setAttributeValue()

Definition at line 2515 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [15/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QPointF & point )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable associated with name in the current context to the x and y coordinates of point.

See also
setAttributeValue()

Definition at line 2544 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [16/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QSize & size )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable associated with name in the current context to the width and height of the given size.

See also
setAttributeValue()

Definition at line 2573 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [17/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QSizeF & size )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable associated with name in the current context to the width and height of the given size.

See also
setAttributeValue()

Definition at line 2602 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [18/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QTransform & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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))}.

Definition at line 3013 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [19/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QVector2D & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to value.

See also
setAttributeValue()

Definition at line 2404 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [20/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QVector3D & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to value.

See also
setAttributeValue()

Definition at line 2430 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [21/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
const QVector4D & value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to value.

See also
setAttributeValue()

Definition at line 2456 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [22/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
GLfloat value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to value.

See also
setAttributeValue()

Definition at line 2228 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [23/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
GLfloat x,
GLfloat y )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to the 2D vector (x, y).

See also
setAttributeValue()

Definition at line 2316 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [24/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
GLfloat x,
GLfloat y,
GLfloat z )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to the 3D vector (x, y, z).

See also
setAttributeValue()

Definition at line 2346 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [25/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
GLfloat x,
GLfloat y,
GLfloat z,
GLfloat w )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to the 4D vector (x, y, z, w).

See also
setAttributeValue()

Definition at line 2377 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [26/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
GLint value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to value.

See also
setAttributeValue()

Definition at line 2254 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [27/54]

void QOpenGLShaderProgram::setUniformValue ( const char * name,
GLuint value )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable called name in the current context to value.

This function should be used when setting sampler values.

Note
This function is not aware of unsigned int support in modern OpenGL versions and therefore treats value as a GLint and calls glUniform1i.
See also
setAttributeValue()

Definition at line 2287 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [28/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const GLfloat value[2][2] )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

See also
setAttributeValue()

Definition at line 2898 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [29/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const GLfloat value[3][3] )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

See also
setAttributeValue()

Definition at line 2915 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [30/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const GLfloat value[4][4] )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

See also
setAttributeValue()

Definition at line 2932 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [31/54]

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.

See also
setAttributeValue()

Definition at line 2467 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [32/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const QMatrix2x2 & value )

Sets the uniform variable at location in the current context to a 2x2 matrix value.

See also
setAttributeValue()

Definition at line 2613 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [33/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const QMatrix2x3 & value )

Sets the uniform variable at location in the current context to a 2x3 matrix value.

Note
This function is not aware of non square matrix support, that is, GLSL types like mat2x3, that is present in modern OpenGL versions. Instead, it treats the uniform as an array of vec3.
See also
setAttributeValue()

Definition at line 2643 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [34/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const QMatrix2x4 & value )

Sets the uniform variable at location in the current context to a 2x4 matrix value.

Note
This function is not aware of non square matrix support, that is, GLSL types like mat2x4, that is present in modern OpenGL versions. Instead, it treats the uniform as an array of vec4.
See also
setAttributeValue()

Definition at line 2677 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [35/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const QMatrix3x2 & value )

Sets the uniform variable at location in the current context to a 3x2 matrix value.

Note
This function is not aware of non square matrix support, that is, GLSL types like mat3x2, that is present in modern OpenGL versions. Instead, it treats the uniform as an array of vec2.
See also
setAttributeValue()

Definition at line 2711 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [36/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const QMatrix3x3 & value )

Sets the uniform variable at location in the current context to a 3x3 matrix value.

See also
setAttributeValue()

Definition at line 2741 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [37/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const QMatrix3x4 & value )

Sets the uniform variable at location in the current context to a 3x4 matrix value.

Note
This function is not aware of non square matrix support, that is, GLSL types like mat3x4, that is present in modern OpenGL versions. Instead, it treats the uniform as an array of vec4.
See also
setAttributeValue()

Definition at line 2771 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [38/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const QMatrix4x2 & value )

Sets the uniform variable at location in the current context to a 4x2 matrix value.

Note
This function is not aware of non square matrix support, that is, GLSL types like mat4x2, that is present in modern OpenGL versions. Instead, it treats the uniform as an array of vec2.
See also
setAttributeValue()

Definition at line 2805 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [39/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const QMatrix4x3 & value )

Sets the uniform variable at location in the current context to a 4x3 matrix value.

Note
This function is not aware of non square matrix support, that is, GLSL types like mat4x3, that is present in modern OpenGL versions. Instead, it treats the uniform as an array of vec3.
See also
setAttributeValue()

Definition at line 2839 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [40/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const QMatrix4x4 & value )

Sets the uniform variable at location in the current context to a 4x4 matrix value.

See also
setAttributeValue()

Definition at line 2869 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [41/54]

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.

See also
setAttributeValue()

Definition at line 2497 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [42/54]

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.

See also
setAttributeValue()

Definition at line 2526 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [43/54]

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.

See also
setAttributeValue()

Definition at line 2555 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [44/54]

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.

See also
setAttributeValue()

Definition at line 2584 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [45/54]

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))}.

Definition at line 2990 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [46/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const QVector2D & value )

Sets the uniform variable at location in the current context to value.

See also
setAttributeValue()

Definition at line 2388 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [47/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const QVector3D & value )

Sets the uniform variable at location in the current context to value.

See also
setAttributeValue()

Definition at line 2414 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [48/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
const QVector4D & value )

Sets the uniform variable at location in the current context to value.

See also
setAttributeValue()

Definition at line 2440 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [49/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
GLfloat value )

Sets the uniform variable at location in the current context to value.

See also
setAttributeValue()

Definition at line 2212 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [50/54]

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).

See also
setAttributeValue()

Definition at line 2298 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [51/54]

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).

See also
setAttributeValue()

Definition at line 2327 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [52/54]

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).

See also
setAttributeValue()

Definition at line 2358 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [53/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
GLint value )

Sets the uniform variable at location in the current context to value.

See also
setAttributeValue()

Definition at line 2238 of file qopenglshaderprogram.cpp.

◆ setUniformValue() [54/54]

void QOpenGLShaderProgram::setUniformValue ( int location,
GLuint value )

Sets the uniform variable at location in the current context to value.

This function should be used when setting sampler values.

Note
This function is not aware of unsigned int support in modern OpenGL versions and therefore treats value as a GLint and calls glUniform1i.
See also
setAttributeValue()

Definition at line 2268 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [1/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const GLfloat * values,
int count,
int tupleSize )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.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.

See also
setAttributeValue()

Definition at line 3114 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [2/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const GLint * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count elements of values.

See also
setAttributeValue()

Definition at line 3041 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [3/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const GLuint * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count elements of values.

This overload should be used when setting an array of sampler values.

See also
setAttributeValue()

Definition at line 3074 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [4/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const QMatrix2x2 * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 2x2 matrix elements of values.

See also
setAttributeValue()

Definition at line 3258 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [5/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const QMatrix2x3 * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 2x3 matrix elements of values.

See also
setAttributeValue()

Definition at line 3286 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [6/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const QMatrix2x4 * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 2x4 matrix elements of values.

See also
setAttributeValue()

Definition at line 3314 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [7/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const QMatrix3x2 * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 3x2 matrix elements of values.

See also
setAttributeValue()

Definition at line 3342 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [8/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const QMatrix3x3 * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 3x3 matrix elements of values.

See also
setAttributeValue()

Definition at line 3369 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [9/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const QMatrix3x4 * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 3x4 matrix elements of values.

See also
setAttributeValue()

Definition at line 3397 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [10/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const QMatrix4x2 * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 4x2 matrix elements of values.

See also
setAttributeValue()

Definition at line 3425 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [11/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const QMatrix4x3 * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 4x3 matrix elements of values.

See also
setAttributeValue()

Definition at line 3453 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [12/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const QMatrix4x4 * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 4x4 matrix elements of values.

See also
setAttributeValue()

Definition at line 3480 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [13/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const QVector2D * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 2D vector elements of values.

See also
setAttributeValue()

Definition at line 3142 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [14/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const QVector3D * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 3D vector elements of values.

See also
setAttributeValue()

Definition at line 3169 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [15/30]

void QOpenGLShaderProgram::setUniformValueArray ( const char * name,
const QVector4D * values,
int count )

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the uniform variable array called name in the current context to the count 4D vector elements of values.

See also
setAttributeValue()

Definition at line 3196 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [16/30]

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.

See also
setAttributeValue()

Definition at line 3087 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [17/30]

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.

See also
setAttributeValue()

Definition at line 3025 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [18/30]

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.

Note
This function is not aware of unsigned int support in modern OpenGL versions and therefore treats values as a GLint and calls glUniform1iv.
See also
setAttributeValue()

Definition at line 3057 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [19/30]

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.

See also
setAttributeValue()

Definition at line 3242 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [20/30]

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.

See also
setAttributeValue()

Definition at line 3269 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [21/30]

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.

See also
setAttributeValue()

Definition at line 3297 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [22/30]

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.

See also
setAttributeValue()

Definition at line 3325 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [23/30]

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.

See also
setAttributeValue()

Definition at line 3353 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [24/30]

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.

See also
setAttributeValue()

Definition at line 3380 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [25/30]

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.

See also
setAttributeValue()

Definition at line 3408 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [26/30]

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.

See also
setAttributeValue()

Definition at line 3436 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [27/30]

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.

See also
setAttributeValue()

Definition at line 3464 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [28/30]

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.

See also
setAttributeValue()

Definition at line 3126 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [29/30]

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.

See also
setAttributeValue()

Definition at line 3153 of file qopenglshaderprogram.cpp.

◆ setUniformValueArray() [30/30]

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.

See also
setAttributeValue()

Definition at line 3180 of file qopenglshaderprogram.cpp.

◆ shaders()

QList< QOpenGLShader * > QOpenGLShaderProgram::shaders ( ) const

Returns a list of all shaders that have been added to this shader program using addShader().

See also
addShader(), removeShader()

Definition at line 1236 of file qopenglshaderprogram.cpp.

◆ uniformLocation() [1/3]

int QOpenGLShaderProgram::uniformLocation ( const char * name) const

Returns the location of the uniform variable name within this shader program's parameter list.

Returns -1 if name is not a valid uniform variable for this shader program.

See also
attributeLocation()

Definition at line 2167 of file qopenglshaderprogram.cpp.

◆ uniformLocation() [2/3]

int QOpenGLShaderProgram::uniformLocation ( const QByteArray & name) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the location of the uniform variable name within this shader program's parameter list.

Returns -1 if name is not a valid uniform variable for this shader program.

See also
attributeLocation()

Definition at line 2188 of file qopenglshaderprogram.cpp.

◆ uniformLocation() [3/3]

int QOpenGLShaderProgram::uniformLocation ( const QString & name) const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns the location of the uniform variable name within this shader program's parameter list.

Returns -1 if name is not a valid uniform variable for this shader program.

See also
attributeLocation()

Definition at line 2202 of file qopenglshaderprogram.cpp.


The documentation for this class was generated from the following files: