Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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 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 69 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 822 of file qopenglshaderprogram.cpp.

◆ ~QOpenGLShaderProgram()

QOpenGLShaderProgram::~QOpenGLShaderProgram ( )

Deletes this shader program.

Definition at line 830 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 1033 of file qopenglshaderprogram.cpp.

References addCacheableShaderFromSourceCode(), addShaderFromSourceCode(), d, and QByteArray().

Referenced by QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(), addCacheableShaderFromSourceCode(), addCacheableShaderFromSourceCode(), and QOpenGLTextureGlyphCache::resizeTextureData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 1102 of file qopenglshaderprogram.cpp.

References addShaderFromSourceCode(), d, and qt_shaderTypeToStage().

+ Here is the call graph for this function:

◆ 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 1130 of file qopenglshaderprogram.cpp.

References addCacheableShaderFromSourceCode(), addShaderFromSourceCode(), and d.

+ Here is the call graph for this function:

◆ 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 1159 of file qopenglshaderprogram.cpp.

References addShaderFromSourceFile(), d, fileName, qPrintable, qt_shaderTypeToStage(), qWarning, QIODeviceBase::ReadOnly, and QIODeviceBase::Text.

+ Here is the call graph for this function:

◆ 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 895 of file qopenglshaderprogram.cpp.

References QObject::connect(), d, QObject::destroyed(), qWarning, SIGNAL, and SLOT.

Referenced by addShaderFromSourceCode(), and addShaderFromSourceFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 932 of file qopenglshaderprogram.cpp.

References addShader(), and d.

Referenced by QtWaylandClient::DecorationsBlitter::DecorationsBlitter(), addCacheableShaderFromSourceCode(), addCacheableShaderFromSourceCode(), addCacheableShaderFromSourceCode(), addShaderFromSourceCode(), and addShaderFromSourceCode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 962 of file qopenglshaderprogram.cpp.

References addShaderFromSourceCode().

+ Here is the call graph for this function:

◆ 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 982 of file qopenglshaderprogram.cpp.

References addShaderFromSourceCode().

+ Here is the call graph for this function:

◆ 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 999 of file qopenglshaderprogram.cpp.

References addShader(), d, and fileName.

Referenced by addCacheableShaderFromSourceFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 1472 of file qopenglshaderprogram.cpp.

References d, and qWarning.

Referenced by attributeLocation(), attributeLocation(), disableAttributeArray(), enableAttributeArray(), setAttributeArray(), setAttributeArray(), setAttributeArray(), setAttributeArray(), setAttributeArray(), setAttributeBuffer(), setAttributeValue(), setAttributeValue(), setAttributeValue(), setAttributeValue(), setAttributeValue(), setAttributeValue(), setAttributeValue(), setAttributeValue(), and setAttributeValue().

+ Here is the caller graph for this function:

◆ 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 1492 of file qopenglshaderprogram.cpp.

References attributeLocation().

+ Here is the call graph for this function:

◆ 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 1506 of file qopenglshaderprogram.cpp.

References attributeLocation().

+ Here is the call graph for this function:

◆ 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 1355 of file qopenglshaderprogram.cpp.

References QOpenGLContextGroup::currentContextGroup(), d, GLuint, link(), and qWarning.

Referenced by QtWaylandClient::DecorationsBlitter::DecorationsBlitter(), QOpenGLTextureBlitter::bind(), QOpenGLTextureGlyphCache::resizeTextureData(), QOpenGLEngineShaderManager::useBlitProgram(), and QOpenGLEngineShaderManager::useSimpleProgram().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 1420 of file qopenglshaderprogram.cpp.

References d.

Referenced by QtWaylandClient::DecorationsBlitter::DecorationsBlitter(), QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(), bindAttributeLocation(), bindAttributeLocation(), and QOpenGLTextureGlyphCache::resizeTextureData().

+ Here is the caller graph for this function:

◆ 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 1442 of file qopenglshaderprogram.cpp.

References bindAttributeLocation().

+ Here is the call graph for this function:

◆ 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 1460 of file qopenglshaderprogram.cpp.

References bindAttributeLocation().

+ Here is the call graph for this function:

◆ 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 849 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 3649 of file qopenglshaderprogram.cpp.

References d, and GL_PATCH_DEFAULT_INNER_LEVEL.

◆ 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 3576 of file qopenglshaderprogram.cpp.

References d, and GL_PATCH_DEFAULT_OUTER_LEVEL.

◆ 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 2134 of file qopenglshaderprogram.cpp.

References attributeLocation(), and disableAttributeArray().

+ Here is the call graph for this function:

◆ 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 2117 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

Referenced by disableAttributeArray(), and QOpenGLTextureGlyphCache::resizeTextureData().

+ Here is the caller graph for this function:

◆ 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 2105 of file qopenglshaderprogram.cpp.

References attributeLocation(), and enableAttributeArray().

+ Here is the call graph for this function:

◆ 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 2087 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

Referenced by QtWaylandClient::DecorationsBlitter::DecorationsBlitter(), and enableAttributeArray().

+ Here is the caller graph for this function:

◆ 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 3671 of file qopenglshaderprogram.cpp.

References context, QOpenGLContext::currentContext(), QOpenGLFunctions::hasOpenGLFeature(), and QOpenGLFunctions::Shaders.

+ Here is the call graph for this function:

◆ isLinked()

bool QOpenGLShaderProgram::isLinked ( ) const

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

See also
link()

Definition at line 1327 of file qopenglshaderprogram.cpp.

References d.

Referenced by QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders().

+ Here is the caller graph for this function:

◆ 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 1273 of file qopenglshaderprogram.cpp.

References d, QString::fromLatin1(), GL_INFO_LOG_LENGTH, GL_LINK_STATUS, GLint(), GLuint, QObject::objectName, qUtf16Printable, and qWarning.

Referenced by QtWaylandClient::DecorationsBlitter::DecorationsBlitter(), QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(), bind(), and QOpenGLTextureGlyphCache::resizeTextureData().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 1339 of file qopenglshaderprogram.cpp.

References d.

Referenced by QtWaylandClient::DecorationsBlitter::DecorationsBlitter(), and QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders().

+ Here is the caller graph for this function:

◆ maxGeometryOutputVertices()

int QOpenGLShaderProgram::maxGeometryOutputVertices ( ) const

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

Definition at line 3468 of file qopenglshaderprogram.cpp.

References d, GL_MAX_GEOMETRY_OUTPUT_VERTICES, and GLint().

+ Here is the call graph for this function:

◆ 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 3508 of file qopenglshaderprogram.cpp.

References d, and GL_PATCH_VERTICES.

◆ programId()

GLuint QOpenGLShaderProgram::programId ( ) const

Returns the OpenGL identifier associated with this shader program.

See also
QOpenGLShader::shaderId()

Definition at line 1394 of file qopenglshaderprogram.cpp.

References d, and GLuint.

◆ 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 1379 of file qopenglshaderprogram.cpp.

References QOpenGLContextGroup::currentContextGroup(), d, and qWarning.

Referenced by QOpenGLTextureBlitter::release().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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 1229 of file qopenglshaderprogram.cpp.

References d, and qDeleteAll().

+ Here is the call graph for this function:

◆ 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 1193 of file qopenglshaderprogram.cpp.

References d, QObject::destroyed(), disconnect(), SIGNAL, and SLOT.

+ Here is the call graph for this function:

◆ 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 1924 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeArray().

+ Here is the call graph for this function:

◆ 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 1945 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeArray().

+ Here is the call graph for this function:

◆ 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 1966 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeArray().

+ Here is the call graph for this function:

◆ 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 1987 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeArray().

+ Here is the call graph for this function:

◆ 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 2015 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeArray().

+ Here is the call graph for this function:

◆ 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 1791 of file qopenglshaderprogram.cpp.

References d, GL_FLOAT, and Q_UNUSED.

Referenced by setAttributeArray(), setAttributeArray(), setAttributeArray(), setAttributeArray(), and setAttributeArray().

+ Here is the caller graph for this function:

◆ 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 1815 of file qopenglshaderprogram.cpp.

References d, GL_FLOAT, and Q_UNUSED.

◆ 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 1839 of file qopenglshaderprogram.cpp.

References d, GL_FLOAT, and Q_UNUSED.

◆ 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 1863 of file qopenglshaderprogram.cpp.

References d, GL_FLOAT, and Q_UNUSED.

◆ 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 1897 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2073 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeBuffer().

+ Here is the call graph for this function:

◆ 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 2042 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

Referenced by QtWaylandClient::DecorationsBlitter::DecorationsBlitter(), QtWaylandClient::DecorationsBlitter::blit(), and setAttributeBuffer().

+ Here is the caller graph for this function:

◆ 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 1771 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeValue().

+ Here is the call graph for this function:

◆ 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 1721 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeValue().

+ Here is the call graph for this function:

◆ 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 1643 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeValue().

+ Here is the call graph for this function:

◆ 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 1668 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeValue().

+ Here is the call graph for this function:

◆ 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 1693 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeValue().

+ Here is the call graph for this function:

◆ 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 1530 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeValue().

+ Here is the call graph for this function:

◆ 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 1558 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeValue().

+ Here is the call graph for this function:

◆ 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 1588 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeValue().

+ Here is the call graph for this function:

◆ 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 1618 of file qopenglshaderprogram.cpp.

References attributeLocation(), and setAttributeValue().

+ Here is the call graph for this function:

◆ 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 1735 of file qopenglshaderprogram.cpp.

References d, Q_UNUSED, and qWarning.

◆ 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 1703 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 1629 of file qopenglshaderprogram.cpp.

References d, and GLfloat().

+ Here is the call graph for this function:

◆ 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 1653 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 1678 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 1516 of file qopenglshaderprogram.cpp.

References d.

Referenced by setAttributeValue(), setAttributeValue(), setAttributeValue(), setAttributeValue(), setAttributeValue(), setAttributeValue(), setAttributeValue(), setAttributeValue(), and setAttributeValue().

+ Here is the caller graph for this function:

◆ 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 1541 of file qopenglshaderprogram.cpp.

References d, and GLfloat().

+ Here is the call graph for this function:

◆ 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 1569 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 1600 of file qopenglshaderprogram.cpp.

References d, and GLfloat().

+ Here is the call graph for this function:

◆ 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 3609 of file qopenglshaderprogram.cpp.

References d, GL_PATCH_DEFAULT_INNER_LEVEL, i, and Q_UNUSED.

◆ 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 3536 of file qopenglshaderprogram.cpp.

References d, GL_PATCH_DEFAULT_OUTER_LEVEL, i, and Q_UNUSED.

◆ 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 3494 of file qopenglshaderprogram.cpp.

References d, and GL_PATCH_VERTICES.

◆ 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 2929 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2943 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2957 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2465 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2607 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2641 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2675 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2709 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2735 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2769 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2803 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2837 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2863 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2494 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2523 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2552 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2581 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2992 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2383 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2409 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2435 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2207 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2295 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2325 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2356 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2233 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2266 of file qopenglshaderprogram.cpp.

References setUniformValue(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 2877 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2894 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2911 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2446 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 2592 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2622 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2656 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2690 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2720 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2750 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2784 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2818 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2848 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2476 of file qopenglshaderprogram.cpp.

References d, GLfloat(), Q_UNUSED, QPoint::x(), and QPoint::y().

+ Here is the call graph for this function:

◆ 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 2505 of file qopenglshaderprogram.cpp.

References d, GLfloat(), Q_UNUSED, QPointF::x(), and QPointF::y().

+ Here is the call graph for this function:

◆ 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 2534 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 2563 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 2969 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 2367 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 2393 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 2419 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ setUniformValue() [49/54]

◆ 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 2277 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 2306 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 2337 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 2217 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 2247 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 3093 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3020 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3053 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3237 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3265 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3293 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3321 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3348 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3376 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3404 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3432 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3459 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3121 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3148 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3175 of file qopenglshaderprogram.cpp.

References setUniformValueArray(), and uniformLocation().

+ Here is the call graph for this function:

◆ 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 3066 of file qopenglshaderprogram.cpp.

References d, Q_UNUSED, and qWarning.

Referenced by setUniformValueArray(), setUniformValueArray(), setUniformValueArray(), setUniformValueArray(), setUniformValueArray(), setUniformValueArray(), setUniformValueArray(), setUniformValueArray(), setUniformValueArray(), setUniformValueArray(), setUniformValueArray(), setUniformValueArray(), setUniformValueArray(), setUniformValueArray(), and setUniformValueArray().

+ Here is the caller graph for this function:

◆ 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 3004 of file qopenglshaderprogram.cpp.

References d, and Q_UNUSED.

◆ 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 3036 of file qopenglshaderprogram.cpp.

References d, GLint(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 3221 of file qopenglshaderprogram.cpp.

References d, Q_UNUSED, and setUniformMatrixArray.

◆ 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 3248 of file qopenglshaderprogram.cpp.

References d, Q_UNUSED, and setUniformGenericMatrixArray.

◆ 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 3276 of file qopenglshaderprogram.cpp.

References d, Q_UNUSED, and setUniformGenericMatrixArray.

◆ 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 3304 of file qopenglshaderprogram.cpp.

References d, Q_UNUSED, and setUniformGenericMatrixArray.

◆ 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 3332 of file qopenglshaderprogram.cpp.

References d, Q_UNUSED, and setUniformMatrixArray.

◆ 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 3359 of file qopenglshaderprogram.cpp.

References d, Q_UNUSED, and setUniformGenericMatrixArray.

◆ 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 3387 of file qopenglshaderprogram.cpp.

References d, Q_UNUSED, and setUniformGenericMatrixArray.

◆ 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 3415 of file qopenglshaderprogram.cpp.

References d, Q_UNUSED, and setUniformGenericMatrixArray.

◆ 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 3443 of file qopenglshaderprogram.cpp.

References d, Q_UNUSED, and setUniformMatrixArray.

◆ 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 3105 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 3132 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 3159 of file qopenglshaderprogram.cpp.

References d, GLfloat(), and Q_UNUSED.

+ Here is the call graph for this function:

◆ 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 1215 of file qopenglshaderprogram.cpp.

References d.

◆ uniformLocation() [1/3]

◆ 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 2167 of file qopenglshaderprogram.cpp.

References uniformLocation().

+ Here is the call graph for this function:

◆ 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 2181 of file qopenglshaderprogram.cpp.

References uniformLocation().

+ Here is the call graph for this function:

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