Qt 4.8
Public Functions | Static Public Functions | Private Slots | Private Functions | List of all members
QGLShaderProgram Class Reference

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

#include <qglshaderprogram.h>

Inheritance diagram for QGLShaderProgram:
QObject

Public Functions

bool addShader (QGLShader *shader)
 Adds a compiled shader to this shader program. More...
 
bool addShaderFromSourceCode (QGLShader::ShaderType type, const char *source)
 Compiles source as a shader of the specified type and adds it to this shader program. More...
 
bool addShaderFromSourceCode (QGLShader::ShaderType type, const QByteArray &source)
 Compiles source as a shader of the specified type and adds it to this shader program. More...
 
bool addShaderFromSourceCode (QGLShader::ShaderType type, const QString &source)
 Compiles source as a shader of the specified type and adds it to this shader program. More...
 
bool addShaderFromSourceFile (QGLShader::ShaderType type, const QString &fileName)
 Compiles the contents of fileName as a shader of the specified type and adds it to this shader program. More...
 
int attributeLocation (const char *name) const
 Returns the location of the attribute name within this shader program's parameter list. More...
 
int attributeLocation (const QByteArray &name) const
 Returns the location of the attribute name within this shader program's parameter list. More...
 
int attributeLocation (const QString &name) const
 Returns the location of the attribute name within this shader program's parameter list. More...
 
bool bind ()
 Binds this shader program to the active QGLContext and makes it the current shader program. More...
 
void bindAttributeLocation (const char *name, int location)
 Binds the attribute name to the specified location. More...
 
void bindAttributeLocation (const QByteArray &name, int location)
 Binds the attribute name to the specified location. More...
 
void bindAttributeLocation (const QString &name, int location)
 Binds the attribute name to the specified location. More...
 
void disableAttributeArray (int location)
 Disables the vertex array at location in this shader program that was enabled by a previous call to enableAttributeArray(). More...
 
void disableAttributeArray (const char *name)
 Disables the vertex array called name in this shader program that was enabled by a previous call to enableAttributeArray(). More...
 
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. More...
 
void enableAttributeArray (const char *name)
 Enables the vertex array called name in this shader program so that the value set by setAttributeArray() on name will be used by the shader program. More...
 
GLenum geometryInputType () const
 Returns the geometry shader input type, if active. More...
 
GLenum geometryOutputType () const
 Returns the geometry shader output type, if active. More...
 
int geometryOutputVertexCount () const
 Returns the maximum number of vertices the current geometry shader program will produce, if active. More...
 
bool isLinked () const
 Returns true if this shader program has been linked; false otherwise. More...
 
virtual bool link ()
 Links together the shaders that were added to this program with addShader(). More...
 
QString log () const
 Returns the errors and warnings that occurred during the last link() or addShader() with explicitly specified source code. More...
 
int maxGeometryOutputVertices () const
 Returns the hardware limit for how many vertices a geometry shader can output. More...
 
GLuint programId () const
 Returns the OpenGL identifier associated with this shader program. More...
 
 QGLShaderProgram (QObject *parent=0)
 Constructs a new shader program and attaches it to parent. More...
 
 QGLShaderProgram (const QGLContext *context, QObject *parent=0)
 Constructs a new shader program and attaches it to parent. More...
 
void release ()
 Releases the active shader program from the current QGLContext. More...
 
void removeAllShaders ()
 Removes all of the shaders that were added to this program previously. More...
 
void removeShader (QGLShader *shader)
 Removes shader from this shader program. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void setAttributeArray (const char *name, const GLfloat *values, int tupleSize, int stride=0)
 Sets an array of vertex values on the attribute called name in this shader program. More...
 
void setAttributeArray (const char *name, const QVector2D *values, int stride=0)
 Sets an array of 2D vertex values on the attribute called name in this shader program. More...
 
void setAttributeArray (const char *name, const QVector3D *values, int stride=0)
 Sets an array of 3D vertex values on the attribute called name in this shader program. More...
 
void setAttributeArray (const char *name, const QVector4D *values, int stride=0)
 Sets an array of 4D vertex values on the attribute called name in this shader program. More...
 
void setAttributeArray (const char *name, GLenum type, const void *values, int tupleSize, int stride=0)
 Sets an array of vertex values on the attribute called name in this shader program. More...
 
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. More...
 
void setAttributeBuffer (const char *name, GLenum type, int offset, int tupleSize, int stride=0)
 Sets an array of vertex values on the attribute called name in this shader program, starting at a specific offset in the currently bound vertex buffer. More...
 
void setAttributeValue (int location, GLfloat value)
 Sets the attribute at location in the current context to value. More...
 
void setAttributeValue (int location, GLfloat x, GLfloat y)
 Sets the attribute at location in the current context to the 2D vector (x, y). More...
 
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). More...
 
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). More...
 
void setAttributeValue (int location, const QVector2D &value)
 Sets the attribute at location in the current context to value. More...
 
void setAttributeValue (int location, const QVector3D &value)
 Sets the attribute at location in the current context to value. More...
 
void setAttributeValue (int location, const QVector4D &value)
 Sets the attribute at location in the current context to value. More...
 
void setAttributeValue (int location, const QColor &value)
 Sets the attribute at location in the current context to value. More...
 
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. More...
 
void setAttributeValue (const char *name, GLfloat value)
 Sets the attribute called name in the current context to value. More...
 
void setAttributeValue (const char *name, GLfloat x, GLfloat y)
 Sets the attribute called name in the current context to the 2D vector (x, y). More...
 
void setAttributeValue (const char *name, GLfloat x, GLfloat y, GLfloat z)
 Sets the attribute called name in the current context to the 3D vector (x, y, z). More...
 
void setAttributeValue (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 Sets the attribute called name in the current context to the 4D vector (x, y, z, w). More...
 
void setAttributeValue (const char *name, const QVector2D &value)
 Sets the attribute called name in the current context to value. More...
 
void setAttributeValue (const char *name, const QVector3D &value)
 Sets the attribute called name in the current context to value. More...
 
void setAttributeValue (const char *name, const QVector4D &value)
 Sets the attribute called name in the current context to value. More...
 
void setAttributeValue (const char *name, const QColor &value)
 Sets the attribute called name in the current context to value. More...
 
void setAttributeValue (const char *name, const GLfloat *values, int columns, int rows)
 Sets the attribute called name in the current context to the contents of values, which contains columns elements, each consisting of rows elements. More...
 
void setGeometryInputType (GLenum inputType)
 Sets the input type from inputType. More...
 
void setGeometryOutputType (GLenum outputType)
 Sets the output type from the geometry shader, if active, to outputType. More...
 
void setGeometryOutputVertexCount (int count)
 Sets the maximum number of vertices the current geometry shader program will produce, if active, to count. More...
 
void setUniformValue (int location, GLfloat value)
 Sets the uniform variable at location in the current context to value. More...
 
void setUniformValue (int location, GLint value)
 Sets the uniform variable at location in the current context to value. More...
 
void setUniformValue (int location, GLuint value)
 Sets the uniform variable at location in the current context to value. More...
 
void setUniformValue (int location, GLfloat x, GLfloat y)
 Sets the uniform variable at location in the current context to the 2D vector (x, y). More...
 
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). More...
 
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). More...
 
void setUniformValue (int location, const QVector2D &value)
 Sets the uniform variable at location in the current context to value. More...
 
void setUniformValue (int location, const QVector3D &value)
 Sets the uniform variable at location in the current context to value. More...
 
void setUniformValue (int location, const QVector4D &value)
 Sets the uniform variable at location in the current context to value. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void setUniformValue (int location, const QMatrix2x2 &value)
 Sets the uniform variable at location in the current context to a 2x2 matrix value. More...
 
void setUniformValue (int location, const QMatrix2x3 &value)
 Sets the uniform variable at location in the current context to a 2x3 matrix value. More...
 
void setUniformValue (int location, const QMatrix2x4 &value)
 Sets the uniform variable at location in the current context to a 2x4 matrix value. More...
 
void setUniformValue (int location, const QMatrix3x2 &value)
 Sets the uniform variable at location in the current context to a 3x2 matrix value. More...
 
void setUniformValue (int location, const QMatrix3x3 &value)
 Sets the uniform variable at location in the current context to a 3x3 matrix value. More...
 
void setUniformValue (int location, const QMatrix3x4 &value)
 Sets the uniform variable at location in the current context to a 3x4 matrix value. More...
 
void setUniformValue (int location, const QMatrix4x2 &value)
 Sets the uniform variable at location in the current context to a 4x2 matrix value. More...
 
void setUniformValue (int location, const QMatrix4x3 &value)
 Sets the uniform variable at location in the current context to a 4x3 matrix value. More...
 
void setUniformValue (int location, const QMatrix4x4 &value)
 Sets the uniform variable at location in the current context to a 4x4 matrix value. More...
 
void setUniformValue (int location, const GLfloat value[2][2])
 Sets the uniform variable at location in the current context to a 2x2 matrix value. More...
 
void setUniformValue (int location, const GLfloat value[3][3])
 Sets the uniform variable at location in the current context to a 3x3 matrix value. More...
 
void setUniformValue (int location, const GLfloat value[4][4])
 Sets the uniform variable at location in the current context to a 4x4 matrix value. More...
 
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. More...
 
void setUniformValue (const char *name, GLfloat value)
 Sets the uniform variable called name in the current context to value. More...
 
void setUniformValue (const char *name, GLint value)
 Sets the uniform variable called name in the current context to value. More...
 
void setUniformValue (const char *name, GLuint value)
 Sets the uniform variable called name in the current context to value. More...
 
void setUniformValue (const char *name, GLfloat x, GLfloat y)
 Sets the uniform variable called name in the current context to the 2D vector (x, y). More...
 
void setUniformValue (const char *name, GLfloat x, GLfloat y, GLfloat z)
 Sets the uniform variable called name in the current context to the 3D vector (x, y, z). More...
 
void setUniformValue (const char *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
 Sets the uniform variable called name in the current context to the 4D vector (x, y, z, w). More...
 
void setUniformValue (const char *name, const QVector2D &value)
 Sets the uniform variable called name in the current context to value. More...
 
void setUniformValue (const char *name, const QVector3D &value)
 Sets the uniform variable called name in the current context to value. More...
 
void setUniformValue (const char *name, const QVector4D &value)
 Sets the uniform variable called name in the current context to value. More...
 
void setUniformValue (const char *name, const QColor &color)
 Sets the uniform variable called name in the current context to the red, green, blue, and alpha components of color. More...
 
void setUniformValue (const char *name, const QPoint &point)
 Sets the uniform variable associated with name in the current context to the x and y coordinates of point. More...
 
void setUniformValue (const char *name, const QPointF &point)
 Sets the uniform variable associated with name in the current context to the x and y coordinates of point. More...
 
void setUniformValue (const char *name, const QSize &size)
 Sets the uniform variable associated with name in the current context to the width and height of the given size. More...
 
void setUniformValue (const char *name, const QSizeF &size)
 Sets the uniform variable associated with name in the current context to the width and height of the given size. More...
 
void setUniformValue (const char *name, const QMatrix2x2 &value)
 Sets the uniform variable called name in the current context to a 2x2 matrix value. More...
 
void setUniformValue (const char *name, const QMatrix2x3 &value)
 Sets the uniform variable called name in the current context to a 2x3 matrix value. More...
 
void setUniformValue (const char *name, const QMatrix2x4 &value)
 Sets the uniform variable called name in the current context to a 2x4 matrix value. More...
 
void setUniformValue (const char *name, const QMatrix3x2 &value)
 Sets the uniform variable called name in the current context to a 3x2 matrix value. More...
 
void setUniformValue (const char *name, const QMatrix3x3 &value)
 Sets the uniform variable called name in the current context to a 3x3 matrix value. More...
 
void setUniformValue (const char *name, const QMatrix3x4 &value)
 Sets the uniform variable called name in the current context to a 3x4 matrix value. More...
 
void setUniformValue (const char *name, const QMatrix4x2 &value)
 Sets the uniform variable called name in the current context to a 4x2 matrix value. More...
 
void setUniformValue (const char *name, const QMatrix4x3 &value)
 Sets the uniform variable called name in the current context to a 4x3 matrix value. More...
 
void setUniformValue (const char *name, const QMatrix4x4 &value)
 Sets the uniform variable called name in the current context to a 4x4 matrix value. More...
 
void setUniformValue (const char *name, const GLfloat value[2][2])
 Sets the uniform variable called name in the current context to a 2x2 matrix value. More...
 
void setUniformValue (const char *name, const GLfloat value[3][3])
 Sets the uniform variable called name in the current context to a 3x3 matrix value. More...
 
void setUniformValue (const char *name, const GLfloat value[4][4])
 Sets the uniform variable called name in the current context to a 4x4 matrix value. More...
 
void setUniformValue (const char *name, const QTransform &value)
 Sets the uniform variable called name in the current context to a 3x3 transformation matrix value that is specified as a QTransform value. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void setUniformValueArray (const char *name, const GLfloat *values, int count, int tupleSize)
 Sets the uniform variable array called name in the current context to the count elements of values. More...
 
void setUniformValueArray (const char *name, const GLint *values, int count)
 Sets the uniform variable array called name in the current context to the count elements of values. More...
 
void setUniformValueArray (const char *name, const GLuint *values, int count)
 Sets the uniform variable array called name in the current context to the count elements of values. More...
 
void setUniformValueArray (const char *name, const QVector2D *values, int count)
 Sets the uniform variable array called name in the current context to the count 2D vector elements of values. More...
 
void setUniformValueArray (const char *name, const QVector3D *values, int count)
 Sets the uniform variable array called name in the current context to the count 3D vector elements of values. More...
 
void setUniformValueArray (const char *name, const QVector4D *values, int count)
 Sets the uniform variable array called name in the current context to the count 4D vector elements of values. More...
 
void setUniformValueArray (const char *name, const QMatrix2x2 *values, int count)
 Sets the uniform variable array called name in the current context to the count 2x2 matrix elements of values. More...
 
void setUniformValueArray (const char *name, const QMatrix2x3 *values, int count)
 Sets the uniform variable array called name in the current context to the count 2x3 matrix elements of values. More...
 
void setUniformValueArray (const char *name, const QMatrix2x4 *values, int count)
 Sets the uniform variable array called name in the current context to the count 2x4 matrix elements of values. More...
 
void setUniformValueArray (const char *name, const QMatrix3x2 *values, int count)
 Sets the uniform variable array called name in the current context to the count 3x2 matrix elements of values. More...
 
void setUniformValueArray (const char *name, const QMatrix3x3 *values, int count)
 Sets the uniform variable array called name in the current context to the count 3x3 matrix elements of values. More...
 
void setUniformValueArray (const char *name, const QMatrix3x4 *values, int count)
 Sets the uniform variable array called name in the current context to the count 3x4 matrix elements of values. More...
 
void setUniformValueArray (const char *name, const QMatrix4x2 *values, int count)
 Sets the uniform variable array called name in the current context to the count 4x2 matrix elements of values. More...
 
void setUniformValueArray (const char *name, const QMatrix4x3 *values, int count)
 Sets the uniform variable array called name in the current context to the count 4x3 matrix elements of values. More...
 
void setUniformValueArray (const char *name, const QMatrix4x4 *values, int count)
 Sets the uniform variable array called name in the current context to the count 4x4 matrix elements of values. More...
 
QList< QGLShader * > shaders () const
 Returns a list of all shaders that have been added to this shader program using addShader(). More...
 
int uniformLocation (const char *name) const
 Returns the location of the uniform variable name within this shader program's parameter list. More...
 
int uniformLocation (const QByteArray &name) const
 Returns the location of the uniform variable name within this shader program's parameter list. More...
 
int uniformLocation (const QString &name) const
 Returns the location of the uniform variable name within this shader program's parameter list. More...
 
virtual ~QGLShaderProgram ()
 Deletes this shader program. More...
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) 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. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
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. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 

Static Public Functions

static bool hasOpenGLShaderPrograms (const QGLContext *context=0)
 Returns true if shader programs written in the OpenGL Shading Language (GLSL) are supported on this system; false otherwise. More...
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 

Private Slots

void shaderDestroyed ()
 

Private Functions

bool init ()
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

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

Since
4.6

Introduction

This class supports shader programs written in the OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES).

QGLShader and QGLShaderProgram shelter the programmer from the details of compiling and linking vertex and fragment shaders.

The following example creates a vertex shader program using the supplied source code. Once compiled and linked, the shader program is activated in the current QGLContext by calling QGLShaderProgram::bind():

shader.compileSourceCode(code);
QGLShaderProgram program(context);
program.addShader(shader);
program.link();
program.bind();

Writing portable shaders

Shader programs can be difficult to reuse across OpenGL implementations because of varying levels of support for standard vertex attributes and uniform variables. In particular, GLSL/ES lacks all of the standard variables that are present on desktop OpenGL systems: gl_Vertex, gl_Normal, gl_Color, and so on. Desktop OpenGL lacks the variable qualifiers highp, mediump, and lowp.

The QGLShaderProgram class makes the process of writing portable shaders easier by prefixing all shader programs with the following lines on desktop OpenGL:

#define highp
#define mediump
#define lowp

This makes it possible to run most GLSL/ES shader programs on desktop systems. The programmer should restrict themselves to just features that are present in GLSL/ES, and avoid standard variable names that only work on the desktop.

Simple shader example

program.addShaderFromSourceCode(QGLShader::Vertex,
"attribute highp vec4 vertex;\n"
"uniform highp mat4 matrix;\n"
"void main(void)\n"
"{\n"
" gl_Position = matrix * vertex;\n"
"}");
program.addShaderFromSourceCode(QGLShader::Fragment,
"uniform mediump vec4 color;\n"
"void main(void)\n"
"{\n"
" gl_FragColor = color;\n"
"}");
program.link();
program.bind();
int vertexLocation = program.attributeLocation("vertex");
int matrixLocation = program.uniformLocation("matrix");
int colorLocation = program.uniformLocation("color");

With the above shader program active, we can draw a green triangle as follows:

static GLfloat const triangleVertices[] = {
60.0f, 10.0f, 0.0f,
110.0f, 110.0f, 0.0f,
10.0f, 110.0f, 0.0f
};
QColor color(0, 255, 0, 255);
QMatrix4x4 pmvMatrix;
pmvMatrix.ortho(rect());
program.enableAttributeArray(vertexLocation);
program.setAttributeArray(vertexLocation, triangleVertices, 3);
program.setUniformValue(matrixLocation, pmvMatrix);
program.setUniformValue(colorLocation, color);
glDrawArrays(GL_TRIANGLES, 0, 3);
program.disableAttributeArray(vertexLocation);

Binary shaders and programs

Binary shaders may be specified using glShaderBinary() on the return value from QGLShader::shaderId(). The QGLShader instance containing the binary can then be added to the shader program with addShader() and linked in the usual fashion with link().

Binary programs may be specified using glProgramBinaryOES() on the return value from programId(). Then the application should call link(), which will notice that the program has already been specified and linked, allowing other operations to be performed on the shader program.

See also
QGLShader

Definition at line 114 of file qglshaderprogram.h.

Constructors and Destructors

◆ QGLShaderProgram() [1/2]

QGLShaderProgram::QGLShaderProgram ( QObject parent = 0)
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 QGLContext.

See also
addShader()

Definition at line 615 of file qglshaderprogram.cpp.

617 {
618 }
static const QGLContext * currentContext()
Returns the current context, i.e.
Definition: qgl.cpp:3545
Q_INVOKABLE QObject(QObject *parent=0)
Constructs an object with parent object parent.
Definition: qobject.cpp:753

◆ QGLShaderProgram() [2/2]

QGLShaderProgram::QGLShaderProgram ( const QGLContext context,
QObject parent = 0 
)
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 context.

See also
addShader()

Definition at line 628 of file qglshaderprogram.cpp.

629  : QObject(*new QGLShaderProgramPrivate(context), parent)
630 {
631 }
Q_INVOKABLE QObject(QObject *parent=0)
Constructs an object with parent object parent.
Definition: qobject.cpp:753

◆ ~QGLShaderProgram()

QGLShaderProgram::~QGLShaderProgram ( )
virtual

Deletes this shader program.

Definition at line 636 of file qglshaderprogram.cpp.

637 {
638 }

Functions

◆ addShader()

bool QGLShaderProgram::addShader ( QGLShader 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 QGLShaderProgram 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 680 of file qglshaderprogram.cpp.

Referenced by addShaderFromSourceCode(), addShaderFromSourceFile(), QGLEngineSharedShaders::findProgramInCache(), QGLEngineSharedShaders::QGLEngineSharedShaders(), and QGLTextureGlyphCache::resizeTextureData().

681 {
683  if (!init())
684  return false;
685  if (d->shaders.contains(shader))
686  return true; // Already added to this shader program.
687  if (d->programGuard.id() && shader) {
688  if (!QGLContext::areSharing(shader->d_func()->shaderGuard.context(),
689  d->programGuard.context())) {
690  qWarning("QGLShaderProgram::addShader: Program and shader are not associated with same context.");
691  return false;
692  }
693  if (!shader->d_func()->shaderGuard.id())
694  return false;
695  glAttachShader(d->programGuard.id(), shader->d_func()->shaderGuard.id());
696  d->linked = false; // Program needs to be relinked.
697  d->shaders.append(shader);
698  connect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed()));
699  return true;
700  } else {
701  return false;
702  }
703 }
double d
Definition: qnumeric_p.h:62
#define SLOT(a)
Definition: qobjectdefs.h:226
#define Q_D(Class)
Definition: qglobal.h:2482
static bool areSharing(const QGLContext *context1, const QGLContext *context2)
Returns true if context1 and context2 are sharing their GL resources such as textures, shader programs, etc; otherwise returns false.
Definition: qgl.cpp:3319
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void destroyed(QObject *=0)
This signal is emitted immediately before the object obj is destroyed, and can not be blocked...
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
Q_CORE_EXPORT void qWarning(const char *,...)
#define glAttachShader
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ addShaderFromSourceCode() [1/3]

bool QGLShaderProgram::addShaderFromSourceCode ( QGLShader::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 QGLShader first.

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

Definition at line 718 of file qglshaderprogram.cpp.

Referenced by addShaderFromSourceCode(), and ShaderEffectItem::updateShaderProgram().

719 {
721  if (!init())
722  return false;
723  QGLShader *shader = new QGLShader(type, this);
724  if (!shader->compileSourceCode(source)) {
725  d->log = shader->log();
726  delete shader;
727  return false;
728  }
729  d->anonShaders.append(shader);
730  return addShader(shader);
731 }
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
bool compileSourceCode(const char *source)
Sets the source code for this shader and compiles it.
#define Q_D(Class)
Definition: qglobal.h:2482
The QGLShader class allows OpenGL shaders to be compiled.
QString log() const
Returns the errors and warnings that occurred during the last compile.
bool addShader(QGLShader *shader)
Adds a compiled shader to this shader program.
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ addShaderFromSourceCode() [2/3]

bool QGLShaderProgram::addShaderFromSourceCode ( QGLShader::ShaderType  type,
const QByteArray source 
)

Compiles source as a shader of the specified type and adds it to this shader program.

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

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 QGLShader first.

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

Definition at line 751 of file qglshaderprogram.cpp.

752 {
753  return addShaderFromSourceCode(type, source.constData());
754 }
int type
Definition: qmetatype.cpp:239
bool addShaderFromSourceCode(QGLShader::ShaderType type, const char *source)
Compiles source as a shader of the specified type and adds it to this shader program.
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433

◆ addShaderFromSourceCode() [3/3]

bool QGLShaderProgram::addShaderFromSourceCode ( QGLShader::ShaderType  type,
const QString source 
)

Compiles source as a shader of the specified type and adds it to this shader program.

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

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 QGLShader first.

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

Definition at line 774 of file qglshaderprogram.cpp.

775 {
776  return addShaderFromSourceCode(type, source.toLatin1().constData());
777 }
int type
Definition: qmetatype.cpp:239
bool addShaderFromSourceCode(QGLShader::ShaderType type, const char *source)
Compiles source as a shader of the specified type and adds it to this shader program.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433

◆ addShaderFromSourceFile()

bool QGLShaderProgram::addShaderFromSourceFile ( QGLShader::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 QGLShader first.

See also
addShader(), addShaderFromSourceCode()

Definition at line 792 of file qglshaderprogram.cpp.

Referenced by addShaderFromSourceCode().

793 {
795  if (!init())
796  return false;
797  QGLShader *shader = new QGLShader(type, this);
798  if (!shader->compileSourceFile(fileName)) {
799  d->log = shader->log();
800  delete shader;
801  return false;
802  }
803  d->anonShaders.append(shader);
804  return addShader(shader);
805 }
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
#define Q_D(Class)
Definition: qglobal.h:2482
The QGLShader class allows OpenGL shaders to be compiled.
QString log() const
Returns the errors and warnings that occurred during the last compile.
bool addShader(QGLShader *shader)
Adds a compiled shader to this shader program.
bool compileSourceFile(const QString &fileName)
Sets the source code for this shader to the contents of fileName and compiles it. ...
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ attributeLocation() [1/3]

int QGLShaderProgram::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 1103 of file qglshaderprogram.cpp.

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

1104 {
1105  Q_D(const QGLShaderProgram);
1106  if (d->linked) {
1107  return glGetAttribLocation(d->programGuard.id(), name);
1108  } else {
1109  qWarning() << "QGLShaderProgram::attributeLocation(" << name
1110  << "): shader program is not linked";
1111  return -1;
1112  }
1113 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define glGetAttribLocation
const char * name
Q_CORE_EXPORT void qWarning(const char *,...)
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ attributeLocation() [2/3]

int QGLShaderProgram::attributeLocation ( const QByteArray name) const

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

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

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

See also
uniformLocation(), bindAttributeLocation()

Definition at line 1127 of file qglshaderprogram.cpp.

1128 {
1129  return attributeLocation(name.constData());
1130 }
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433

◆ attributeLocation() [3/3]

int QGLShaderProgram::attributeLocation ( const QString name) const

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

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

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

See also
uniformLocation(), bindAttributeLocation()

Definition at line 1144 of file qglshaderprogram.cpp.

1145 {
1146  return attributeLocation(name.toLatin1().constData());
1147 }
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433

◆ bind()

bool QGLShaderProgram::bind ( )

Binds this shader program to the active QGLContext 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 969 of file qglshaderprogram.cpp.

Referenced by blitTexture(), QGLEngineSharedShaders::findProgramInCache(), ShaderEffectItem::renderEffect(), QGLTextureGlyphCache::resizeTextureData(), ShaderEffectItem::updateShaderProgram(), QGLEngineShaderManager::useBlitProgram(), and QGLEngineShaderManager::useSimpleProgram().

970 {
972  GLuint program = d->programGuard.id();
973  if (!program)
974  return false;
975  if (!d->linked && !link())
976  return false;
977 #ifndef QT_NO_DEBUG
978  if (!QGLContext::areSharing(d->programGuard.context(), QGLContext::currentContext())) {
979  qWarning("QGLShaderProgram::bind: program is not valid in the current context.");
980  return false;
981  }
982 #endif
983  glUseProgram(program);
984  return true;
985 }
double d
Definition: qnumeric_p.h:62
#define glUseProgram
#define Q_D(Class)
Definition: qglobal.h:2482
static const QGLContext * currentContext()
Returns the current context, i.e.
Definition: qgl.cpp:3545
static bool areSharing(const QGLContext *context1, const QGLContext *context2)
Returns true if context1 and context2 are sharing their GL resources such as textures, shader programs, etc; otherwise returns false.
Definition: qgl.cpp:3319
Q_CORE_EXPORT void qWarning(const char *,...)
virtual bool link()
Links together the shaders that were added to this program with addShader().
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ bindAttributeLocation() [1/3]

void QGLShaderProgram::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 1045 of file qglshaderprogram.cpp.

Referenced by bindAttributeLocation(), QGLEngineSharedShaders::findProgramInCache(), QGLEngineSharedShaders::QGLEngineSharedShaders(), QGLTextureGlyphCache::resizeTextureData(), and ShaderEffectItem::updateShaderProgram().

1046 {
1048  if (!init())
1049  return;
1050  glBindAttribLocation(d->programGuard.id(), location, name);
1051  d->linked = false; // Program needs to be relinked.
1052 }
double d
Definition: qnumeric_p.h:62
#define glBindAttribLocation
#define Q_D(Class)
Definition: qglobal.h:2482
const char * name
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ bindAttributeLocation() [2/3]

void QGLShaderProgram::bindAttributeLocation ( const QByteArray name,
int  location 
)

Binds the attribute name to the specified location.

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

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 1070 of file qglshaderprogram.cpp.

1071 {
1073 }
void bindAttributeLocation(const char *name, int location)
Binds the attribute name to the specified location.
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63

◆ bindAttributeLocation() [3/3]

void QGLShaderProgram::bindAttributeLocation ( const QString name,
int  location 
)

Binds the attribute name to the specified location.

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

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 1091 of file qglshaderprogram.cpp.

1092 {
1094 }
void bindAttributeLocation(const char *name, int location)
Binds the attribute name to the specified location.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63

◆ disableAttributeArray() [1/2]

void QGLShaderProgram::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 1805 of file qglshaderprogram.cpp.

Referenced by disableAttributeArray(), ShaderEffectItem::renderEffect(), and QGLTextureGlyphCache::resizeTextureData().

1806 {
1808  Q_UNUSED(d);
1809  if (location != -1)
1811 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define glDisableVertexAttribArray
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ disableAttributeArray() [2/2]

void QGLShaderProgram::disableAttributeArray ( const char *  name)

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

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

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

Definition at line 1825 of file qglshaderprogram.cpp.

1826 {
1828 }
void disableAttributeArray(int location)
Disables the vertex array at location in this shader program that was enabled by a previous call to e...
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name

◆ enableAttributeArray() [1/2]

void QGLShaderProgram::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 1772 of file qglshaderprogram.cpp.

Referenced by enableAttributeArray(), ShaderEffectItem::renderEffect(), and QGLTextureGlyphCache::resizeTextureData().

1773 {
1775  Q_UNUSED(d);
1776  if (location != -1)
1778 }
double d
Definition: qnumeric_p.h:62
#define glEnableVertexAttribArray
#define Q_D(Class)
Definition: qglobal.h:2482
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ enableAttributeArray() [2/2]

void QGLShaderProgram::enableAttributeArray ( const char *  name)

Enables the vertex array called name in this shader program so that the value set by setAttributeArray() on name will be used by the shader program.

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

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

Definition at line 1793 of file qglshaderprogram.cpp.

1794 {
1796 }
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name
void enableAttributeArray(int location)
Enables the vertex array at location in this shader program so that the value set by setAttributeArra...

◆ geometryInputType()

GLenum QGLShaderProgram::geometryInputType ( ) const

Returns the geometry shader input type, if active.

This parameter takes effect the next time the program is linked.

Since
4.7

Definition at line 3399 of file qglshaderprogram.cpp.

3400 {
3401  return d_func()->geometryInputType;
3402 }

◆ geometryOutputType()

GLenum QGLShaderProgram::geometryOutputType ( ) const

Returns the geometry shader output type, if active.

This parameter takes effect the next time the program is linked.

Since
4.7

Definition at line 3426 of file qglshaderprogram.cpp.

3427 {
3428  return d_func()->geometryOutputType;
3429 }

◆ geometryOutputVertexCount()

int QGLShaderProgram::geometryOutputVertexCount ( ) const

Returns the maximum number of vertices the current geometry shader program will produce, if active.

Since
4.7

This parameter takes effect the ntext time the program is linked.

Definition at line 3374 of file qglshaderprogram.cpp.

3375 {
3376  return d_func()->geometryVertexCount;
3377 }

◆ hasOpenGLShaderPrograms()

bool QGLShaderProgram::hasOpenGLShaderPrograms ( const QGLContext context = 0)
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 null, then QGLContext::currentContext() is used.

Definition at line 3439 of file qglshaderprogram.cpp.

Referenced by ShaderEffectItem::paint().

3440 {
3441 #if !defined(QT_OPENGL_ES_2)
3442  if (!context)
3443  context = QGLContext::currentContext();
3444  if (!context)
3445  return false;
3446  return qt_resolve_glsl_extensions(const_cast<QGLContext *>(context));
3447 #else
3448  Q_UNUSED(context);
3449  return true;
3450 #endif
3451 }
bool qt_resolve_glsl_extensions(QGLContext *ctx)
static const QGLContext * currentContext()
Returns the current context, i.e.
Definition: qgl.cpp:3545
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ init()

bool QGLShaderProgram::init ( )
private

Definition at line 640 of file qglshaderprogram.cpp.

Referenced by addShader(), addShaderFromSourceCode(), addShaderFromSourceFile(), bindAttributeLocation(), and programId().

641 {
643  if (d->programGuard.id() || d->inited)
644  return true;
645  d->inited = true;
646  const QGLContext *context = d->programGuard.context();
647  if (!context) {
648  context = QGLContext::currentContext();
649  d->programGuard.setContext(context);
650  }
651 
652  if (!context)
653  return false;
654  if (qt_resolve_glsl_extensions(const_cast<QGLContext *>(context))) {
655  GLuint program = glCreateProgram();
656  if (!program) {
657  qWarning() << "QGLShaderProgram: could not create shader program";
658  return false;
659  }
660  d->programGuard.setId(program);
661  return true;
662  } else {
663  qWarning() << "QGLShaderProgram: shader programs are not supported";
664  return false;
665  }
666 }
double d
Definition: qnumeric_p.h:62
#define glCreateProgram
#define Q_D(Class)
Definition: qglobal.h:2482
bool qt_resolve_glsl_extensions(QGLContext *ctx)
static const QGLContext * currentContext()
Returns the current context, i.e.
Definition: qgl.cpp:3545
The QGLContext class encapsulates an OpenGL rendering context.
Definition: qgl.h:310
Q_CORE_EXPORT void qWarning(const char *,...)
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ isLinked()

bool QGLShaderProgram::isLinked ( ) const

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

See also
link()

Definition at line 941 of file qglshaderprogram.cpp.

Referenced by QGLEngineSharedShaders::findProgramInCache(), QGLEngineSharedShaders::QGLEngineSharedShaders(), ShaderEffectItem::renderEffect(), and ShaderEffectItem::updateShaderProgram().

942 {
943  Q_D(const QGLShaderProgram);
944  return d->linked;
945 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ link()

bool QGLShaderProgram::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.

See also
addShader(), log()

Definition at line 879 of file qglshaderprogram.cpp.

Referenced by bind(), QGLEngineSharedShaders::findProgramInCache(), QGLEngineSharedShaders::QGLEngineSharedShaders(), QGLTextureGlyphCache::resizeTextureData(), and ShaderEffectItem::updateShaderProgram().

880 {
882  GLuint program = d->programGuard.id();
883  if (!program)
884  return false;
885 
886  GLint value;
887  if (d->shaders.isEmpty()) {
888  // If there are no explicit shaders, then it is possible that the
889  // application added a program binary with glProgramBinaryOES(),
890  // or otherwise populated the shaders itself. Check to see if the
891  // program is already linked and bail out if so.
892  value = 0;
893  glGetProgramiv(program, GL_LINK_STATUS, &value);
894  d->linked = (value != 0);
895  if (d->linked)
896  return true;
897  }
898 
899  // Set up the geometry shader parameters
901  foreach (QGLShader *shader, d->shaders) {
902  if (shader->shaderType() & QGLShader::Geometry) {
904  d->geometryInputType);
906  d->geometryOutputType);
908  d->geometryVertexCount);
909  break;
910  }
911  }
912  }
913 
914  glLinkProgram(program);
915  value = 0;
916  glGetProgramiv(program, GL_LINK_STATUS, &value);
917  d->linked = (value != 0);
918  value = 0;
919  glGetProgramiv(program, GL_INFO_LOG_LENGTH, &value);
920  d->log = QString();
921  if (value > 1) {
922  char *logbuf = new char [value];
923  GLint len;
924  glGetProgramInfoLog(program, value, &len, logbuf);
925  d->log = QString::fromLatin1(logbuf);
926  QString name = objectName();
927  if (name.isEmpty())
928  qWarning() << "QGLShader::link:" << d->log;
929  else
930  qWarning() << "QGLShader::link[" << name << "]:" << d->log;
931  delete [] logbuf;
932  }
933  return d->linked;
934 }
double d
Definition: qnumeric_p.h:62
#define GL_GEOMETRY_INPUT_TYPE_EXT
QGLShader::ShaderType shaderType() const
Returns the type of this shader.
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_D(Class)
Definition: qglobal.h:2482
#define glLinkProgram
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
const char * name
The QGLShader class allows OpenGL shaders to be compiled.
Q_CORE_EXPORT void qWarning(const char *,...)
#define GL_INFO_LOG_LENGTH
#define glGetProgramiv
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
#define glProgramParameteriEXT
#define GL_GEOMETRY_OUTPUT_TYPE_EXT
QString objectName() const
#define GL_LINK_STATUS
typedef GLint
Definition: glfunctions.h:67
#define GL_GEOMETRY_VERTICES_OUT_EXT
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define glGetProgramInfoLog

◆ log()

QString QGLShaderProgram::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 953 of file qglshaderprogram.cpp.

Referenced by QGLEngineSharedShaders::findProgramInCache(), QGLEngineSharedShaders::QGLEngineSharedShaders(), and ShaderEffectItem::updateShaderProgram().

954 {
955  Q_D(const QGLShaderProgram);
956  return d->log;
957 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ maxGeometryOutputVertices()

int QGLShaderProgram::maxGeometryOutputVertices ( ) const

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

Since
4.7
See also
setGeometryOutputVertexCount()

Definition at line 3338 of file qglshaderprogram.cpp.

Referenced by setGeometryOutputVertexCount().

3339 {
3340  GLint n;
3341  glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT, &n);
3342  return n;
3343 }
#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT
typedef GLint
Definition: glfunctions.h:67

◆ programId()

GLuint QGLShaderProgram::programId ( ) const

Returns the OpenGL identifier associated with this shader program.

See also
QGLShader::shaderId()

Definition at line 1019 of file qglshaderprogram.cpp.

Referenced by ShaderEffectItem::renderEffect().

1020 {
1021  Q_D(const QGLShaderProgram);
1022  GLuint id = d->programGuard.id();
1023  if (id)
1024  return id;
1025 
1026  // Create the identifier if we don't have one yet. This is for
1027  // applications that want to create the attached shader configuration
1028  // themselves, particularly those using program binaries.
1029  if (!const_cast<QGLShaderProgram *>(this)->init())
1030  return 0;
1031  return d->programGuard.id();
1032 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ release()

void QGLShaderProgram::release ( )

Releases the active shader program from the current QGLContext.

This is equivalent to calling glUseProgram(0).

See also
bind()

Definition at line 996 of file qglshaderprogram.cpp.

997 {
998 #ifndef QT_NO_DEBUG
1000  if (!QGLContext::areSharing(d->programGuard.context(), QGLContext::currentContext()))
1001  qWarning("QGLShaderProgram::release: program is not valid in the current context.");
1002 #endif
1003 #if defined(QT_OPENGL_ES_2)
1004  glUseProgram(0);
1005 #else
1006  if (glUseProgram)
1007  glUseProgram(0);
1008 #endif
1009 }
double d
Definition: qnumeric_p.h:62
#define glUseProgram
#define Q_D(Class)
Definition: qglobal.h:2482
static const QGLContext * currentContext()
Returns the current context, i.e.
Definition: qgl.cpp:3545
static bool areSharing(const QGLContext *context1, const QGLContext *context2)
Returns true if context1 and context2 are sharing their GL resources such as textures, shader programs, etc; otherwise returns false.
Definition: qgl.cpp:3319
Q_CORE_EXPORT void qWarning(const char *,...)
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ removeAllShaders()

void QGLShaderProgram::removeAllShaders ( )

Removes all of the shaders that were added to this program previously.

The QGLShader objects for the shaders will not be deleted if they were constructed externally. QGLShader objects that are constructed internally by QGLShaderProgram will be deleted.

See also
addShader(), removeShader()

Definition at line 847 of file qglshaderprogram.cpp.

Referenced by ShaderEffectItem::reset().

848 {
850  d->removingShaders = true;
851  foreach (QGLShader *shader, d->shaders) {
852  if (d->programGuard.id() && shader && shader->d_func()->shaderGuard.id())
853  glDetachShader(d->programGuard.id(), shader->d_func()->shaderGuard.id());
854  }
855  foreach (QGLShader *shader, d->anonShaders) {
856  // Delete shader objects that were created anonymously.
857  delete shader;
858  }
859  d->shaders.clear();
860  d->anonShaders.clear();
861  d->linked = false; // Program needs to be relinked.
862  d->removingShaders = false;
863 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QGLShader class allows OpenGL shaders to be compiled.
#define glDetachShader
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ removeShader()

void QGLShaderProgram::removeShader ( QGLShader shader)

Removes shader from this shader program.

The object is not deleted.

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

Definition at line 812 of file qglshaderprogram.cpp.

Referenced by shaderDestroyed().

813 {
815  if (d->programGuard.id() && shader && shader->d_func()->shaderGuard.id()) {
816  QGLShareContextScope scope(d->programGuard.context());
817  glDetachShader(d->programGuard.id(), shader->d_func()->shaderGuard.id());
818  }
819  d->linked = false; // Program needs to be relinked.
820  if (shader) {
821  d->shaders.removeAll(shader);
822  d->anonShaders.removeAll(shader);
823  disconnect(shader, SIGNAL(destroyed()), this, SLOT(shaderDestroyed()));
824  }
825 }
double d
Definition: qnumeric_p.h:62
#define SLOT(a)
Definition: qobjectdefs.h:226
#define Q_D(Class)
Definition: qglobal.h:2482
#define SIGNAL(a)
Definition: qobjectdefs.h:227
void destroyed(QObject *=0)
This signal is emitted immediately before the object obj is destroyed, and can not be blocked...
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
Definition: qobject.cpp:2895
#define glDetachShader
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ setAttributeArray() [1/10]

void QGLShaderProgram::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 1461 of file qglshaderprogram.cpp.

Referenced by ShaderEffectItem::bindGeometry(), QGLShader::hasOpenGLShaders(), setAttributeArray(), and setAttributeValue().

1462 {
1464  Q_UNUSED(d);
1465  if (location != -1) {
1467  stride, values);
1468  }
1469 }
double d
Definition: qnumeric_p.h:62
#define glVertexAttribPointer
Definition: glfunctions.h:71
#define Q_D(Class)
Definition: qglobal.h:2482
#define GL_FALSE
#define GL_FLOAT
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeArray() [2/10]

void QGLShaderProgram::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 1485 of file qglshaderprogram.cpp.

1486 {
1488  Q_UNUSED(d);
1489  if (location != -1) {
1491  stride, values);
1492  }
1493 }
double d
Definition: qnumeric_p.h:62
#define glVertexAttribPointer
Definition: glfunctions.h:71
#define Q_D(Class)
Definition: qglobal.h:2482
#define GL_FALSE
#define GL_FLOAT
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeArray() [3/10]

void QGLShaderProgram::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 1509 of file qglshaderprogram.cpp.

1510 {
1512  Q_UNUSED(d);
1513  if (location != -1) {
1515  stride, values);
1516  }
1517 }
double d
Definition: qnumeric_p.h:62
#define glVertexAttribPointer
Definition: glfunctions.h:71
#define Q_D(Class)
Definition: qglobal.h:2482
#define GL_FALSE
#define GL_FLOAT
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeArray() [4/10]

void QGLShaderProgram::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 1533 of file qglshaderprogram.cpp.

1534 {
1536  Q_UNUSED(d);
1537  if (location != -1) {
1539  stride, values);
1540  }
1541 }
double d
Definition: qnumeric_p.h:62
#define glVertexAttribPointer
Definition: glfunctions.h:71
#define Q_D(Class)
Definition: qglobal.h:2482
#define GL_FALSE
#define GL_FLOAT
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeArray() [5/10]

void QGLShaderProgram::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.

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

Definition at line 1565 of file qglshaderprogram.cpp.

1566 {
1568  Q_UNUSED(d);
1569  if (location != -1) {
1571  stride, values);
1572  }
1573 }
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
#define GL_TRUE
#define glVertexAttribPointer
Definition: glfunctions.h:71
#define Q_D(Class)
Definition: qglobal.h:2482
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeArray() [6/10]

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

Sets an array of vertex values on the attribute called name in this shader program.

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

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 1595 of file qglshaderprogram.cpp.

1596 {
1597  setAttributeArray(attributeLocation(name), values, tupleSize, stride);
1598 }
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.
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name
quint16 values[128]

◆ setAttributeArray() [7/10]

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

Sets an array of 2D vertex values on the attribute called name in this shader program.

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

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 1619 of file qglshaderprogram.cpp.

1620 {
1621  setAttributeArray(attributeLocation(name), values, stride);
1622 }
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.
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name

◆ setAttributeArray() [8/10]

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

Sets an array of 3D vertex values on the attribute called name in this shader program.

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

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

1644 {
1645  setAttributeArray(attributeLocation(name), values, stride);
1646 }
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.
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name

◆ setAttributeArray() [9/10]

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

Sets an array of 4D vertex values on the attribute called name in this shader program.

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

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 1667 of file qglshaderprogram.cpp.

1668 {
1669  setAttributeArray(attributeLocation(name), values, stride);
1670 }
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.
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name

◆ setAttributeArray() [10/10]

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

Sets an array of vertex values on the attribute called name in this shader program.

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

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()
Since
4.7

Definition at line 1699 of file qglshaderprogram.cpp.

1700 {
1701  setAttributeArray(attributeLocation(name), type, values, tupleSize, stride);
1702 }
int type
Definition: qmetatype.cpp:239
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.
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name
quint16 values[128]

◆ setAttributeBuffer() [1/2]

void QGLShaderProgram::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.

See also
setAttributeArray()
Since
4.7

Definition at line 1724 of file qglshaderprogram.cpp.

Referenced by QGLShader::hasOpenGLShaders(), setAttributeArray(), and setAttributeBuffer().

1725 {
1727  Q_UNUSED(d);
1728  if (location != -1) {
1729  glVertexAttribPointer(location, tupleSize, type, GL_TRUE, stride,
1730  reinterpret_cast<const void *>(offset));
1731  }
1732 }
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
#define GL_TRUE
#define glVertexAttribPointer
Definition: glfunctions.h:71
#define Q_D(Class)
Definition: qglobal.h:2482
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeBuffer() [2/2]

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

Sets an array of vertex values on the attribute called name in this shader program, starting at a specific offset in the currently bound vertex buffer.

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

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()
Since
4.7

Definition at line 1759 of file qglshaderprogram.cpp.

1760 {
1761  setAttributeBuffer(attributeLocation(name), type, offset, tupleSize, stride);
1762 }
int type
Definition: qmetatype.cpp:239
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.
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name

◆ setAttributeValue() [1/18]

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

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

See also
setUniformValue()

Definition at line 1154 of file qglshaderprogram.cpp.

Referenced by setAttributeValue().

1155 {
1157  Q_UNUSED(d);
1158  if (location != -1)
1159  glVertexAttrib1fv(location, &value);
1160 }
double d
Definition: qnumeric_p.h:62
#define glVertexAttrib1fv
#define Q_D(Class)
Definition: qglobal.h:2482
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeValue() [2/18]

void QGLShaderProgram::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 1183 of file qglshaderprogram.cpp.

1184 {
1186  Q_UNUSED(d);
1187  if (location != -1) {
1188  GLfloat values[2] = {x, y};
1189  glVertexAttrib2fv(location, values);
1190  }
1191 }
double d
Definition: qnumeric_p.h:62
#define glVertexAttrib2fv
#define Q_D(Class)
Definition: qglobal.h:2482
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeValue() [3/18]

void QGLShaderProgram::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 1216 of file qglshaderprogram.cpp.

1217 {
1219  Q_UNUSED(d);
1220  if (location != -1) {
1221  GLfloat values[3] = {x, y, z};
1222  glVertexAttrib3fv(location, values);
1223  }
1224 }
double d
Definition: qnumeric_p.h:62
#define glVertexAttrib3fv
#define Q_D(Class)
Definition: qglobal.h:2482
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeValue() [4/18]

void QGLShaderProgram::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 1250 of file qglshaderprogram.cpp.

1251 {
1253  Q_UNUSED(d);
1254  if (location != -1) {
1255  GLfloat values[4] = {x, y, z, w};
1256  glVertexAttrib4fv(location, values);
1257  }
1258 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define glVertexAttrib4fv
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeValue() [5/18]

void QGLShaderProgram::setAttributeValue ( int  location,
const QVector2D value 
)

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

See also
setUniformValue()

Definition at line 1282 of file qglshaderprogram.cpp.

1283 {
1285  Q_UNUSED(d);
1286  if (location != -1)
1287  glVertexAttrib2fv(location, reinterpret_cast<const GLfloat *>(&value));
1288 }
double d
Definition: qnumeric_p.h:62
#define glVertexAttrib2fv
#define Q_D(Class)
Definition: qglobal.h:2482
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeValue() [6/18]

void QGLShaderProgram::setAttributeValue ( int  location,
const QVector3D value 
)

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

See also
setUniformValue()

Definition at line 1310 of file qglshaderprogram.cpp.

1311 {
1313  Q_UNUSED(d);
1314  if (location != -1)
1315  glVertexAttrib3fv(location, reinterpret_cast<const GLfloat *>(&value));
1316 }
double d
Definition: qnumeric_p.h:62
#define glVertexAttrib3fv
#define Q_D(Class)
Definition: qglobal.h:2482
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeValue() [7/18]

void QGLShaderProgram::setAttributeValue ( int  location,
const QVector4D value 
)

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

See also
setUniformValue()

Definition at line 1338 of file qglshaderprogram.cpp.

1339 {
1341  Q_UNUSED(d);
1342  if (location != -1)
1343  glVertexAttrib4fv(location, reinterpret_cast<const GLfloat *>(&value));
1344 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define glVertexAttrib4fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeValue() [8/18]

void QGLShaderProgram::setAttributeValue ( int  location,
const QColor value 
)

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

See also
setUniformValue()

Definition at line 1366 of file qglshaderprogram.cpp.

1367 {
1369  Q_UNUSED(d);
1370  if (location != -1) {
1371  GLfloat values[4] = {GLfloat(value.redF()), GLfloat(value.greenF()),
1372  GLfloat(value.blueF()), GLfloat(value.alphaF())};
1373  glVertexAttrib4fv(location, values);
1374  }
1375 }
double d
Definition: qnumeric_p.h:62
qreal alphaF() const
Returns the alpha color component of this color.
Definition: qcolor.cpp:1106
qreal greenF() const
Returns the green color component of this color.
Definition: qcolor.cpp:1241
#define Q_D(Class)
Definition: qglobal.h:2482
#define glVertexAttrib4fv
quint16 values[128]
qreal redF() const
Returns the red color component of this color.
Definition: qcolor.cpp:1213
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
qreal blueF() const
Returns the blue color component of this color.
Definition: qcolor.cpp:1269
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeValue() [9/18]

void QGLShaderProgram::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 1402 of file qglshaderprogram.cpp.

1403 {
1405  Q_UNUSED(d);
1406  if (rows < 1 || rows > 4) {
1407  qWarning() << "QGLShaderProgram::setAttributeValue: rows" << rows << "not supported";
1408  return;
1409  }
1410  if (location != -1) {
1411  while (columns-- > 0) {
1412  if (rows == 1)
1414  else if (rows == 2)
1416  else if (rows == 3)
1418  else
1420  values += rows;
1421  ++location;
1422  }
1423  }
1424 }
double d
Definition: qnumeric_p.h:62
#define glVertexAttrib3fv
#define glVertexAttrib2fv
#define glVertexAttrib1fv
#define Q_D(Class)
Definition: qglobal.h:2482
#define glVertexAttrib4fv
Q_CORE_EXPORT void qWarning(const char *,...)
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setAttributeValue() [10/18]

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

Sets the attribute called name in the current context to value.

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

See also
setUniformValue()

Definition at line 1172 of file qglshaderprogram.cpp.

1173 {
1175 }
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name
void setAttributeValue(int location, GLfloat value)
Sets the attribute at location in the current context to value.

◆ setAttributeValue() [11/18]

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

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

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

See also
setUniformValue()

Definition at line 1204 of file qglshaderprogram.cpp.

1205 {
1207 }
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name
void setAttributeValue(int location, GLfloat value)
Sets the attribute at location in the current context to value.

◆ setAttributeValue() [12/18]

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

Sets the attribute called name in the current context to the 3D vector (x, y, z).

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

See also
setUniformValue()

Definition at line 1238 of file qglshaderprogram.cpp.

1239 {
1241 }
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name
void setAttributeValue(int location, GLfloat value)
Sets the attribute at location in the current context to value.

◆ setAttributeValue() [13/18]

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

Sets the attribute called name in the current context to the 4D vector (x, y, z, w).

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

See also
setUniformValue()

Definition at line 1272 of file qglshaderprogram.cpp.

1273 {
1275 }
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name
void setAttributeValue(int location, GLfloat value)
Sets the attribute at location in the current context to value.

◆ setAttributeValue() [14/18]

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

Sets the attribute called name in the current context to value.

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

See also
setUniformValue()

Definition at line 1300 of file qglshaderprogram.cpp.

1301 {
1303 }
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name
void setAttributeValue(int location, GLfloat value)
Sets the attribute at location in the current context to value.

◆ setAttributeValue() [15/18]

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

Sets the attribute called name in the current context to value.

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

See also
setUniformValue()

Definition at line 1328 of file qglshaderprogram.cpp.

1329 {
1331 }
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name
void setAttributeValue(int location, GLfloat value)
Sets the attribute at location in the current context to value.

◆ setAttributeValue() [16/18]

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

Sets the attribute called name in the current context to value.

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

See also
setUniformValue()

Definition at line 1356 of file qglshaderprogram.cpp.

1357 {
1359 }
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name
void setAttributeValue(int location, GLfloat value)
Sets the attribute at location in the current context to value.

◆ setAttributeValue() [17/18]

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

Sets the attribute called name in the current context to value.

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

See also
setUniformValue()

Definition at line 1387 of file qglshaderprogram.cpp.

1388 {
1390 }
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name
void setAttributeValue(int location, GLfloat value)
Sets the attribute at location in the current context to value.

◆ setAttributeValue() [18/18]

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

Sets the attribute called name in the current context to the contents of values, which contains columns elements, each consisting of rows elements.

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

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 1441 of file qglshaderprogram.cpp.

1442 {
1443  setAttributeValue(attributeLocation(name), values, columns, rows);
1444 }
int attributeLocation(const char *name) const
Returns the location of the attribute name within this shader program&#39;s parameter list...
const char * name
quint16 values[128]
void setAttributeValue(int location, GLfloat value)
Sets the attribute at location in the current context to value.

◆ setGeometryInputType()

void QGLShaderProgram::setGeometryInputType ( GLenum  inputType)

Sets the input type from inputType.

This parameter takes effect the next time the program is linked.

Definition at line 3385 of file qglshaderprogram.cpp.

3386 {
3387  d_func()->geometryInputType = inputType;
3388 }

◆ setGeometryOutputType()

void QGLShaderProgram::setGeometryOutputType ( GLenum  outputType)

Sets the output type from the geometry shader, if active, to outputType.

This parameter takes effect the next time the program is linked.

Since
4.7

Definition at line 3413 of file qglshaderprogram.cpp.

3414 {
3415  d_func()->geometryOutputType = outputType;
3416 }

◆ setGeometryOutputVertexCount()

void QGLShaderProgram::setGeometryOutputVertexCount ( int  count)

Sets the maximum number of vertices the current geometry shader program will produce, if active, to count.

Since
4.7

This parameter takes effect the next time the program is linked.

Definition at line 3353 of file qglshaderprogram.cpp.

3354 {
3355 #ifndef QT_NO_DEBUG
3356  int max = maxGeometryOutputVertices();
3357  if (count > max) {
3358  qWarning("QGLShaderProgram::setGeometryOutputVertexCount: count: %d higher than maximum: %d",
3359  count, max);
3360  }
3361 #endif
3362  d_func()->geometryVertexCount = count;
3363 }
int maxGeometryOutputVertices() const
Returns the hardware limit for how many vertices a geometry shader can output.
Q_CORE_EXPORT void qWarning(const char *,...)

◆ setUniformValue() [1/54]

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

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

See also
setAttributeValue()

Definition at line 1889 of file qglshaderprogram.cpp.

Referenced by QGL2PaintEngineExPrivate::drawTexture(), QGLEngineSharedShaders::findProgramInCache(), QGLShader::hasOpenGLShaders(), QGL2PaintEngineExPrivate::prepareForDraw(), QGLTextureGlyphCache::resizeTextureData(), QGLPixmapColorizeFilter::setUniforms(), QGLPixmapConvolutionFilter::setUniforms(), QGLPixmapDropShadowFilter::setUniforms(), setUniformValue(), QGL2PaintEngineExPrivate::updateBrushUniforms(), ShaderEffectItem::updateEffectState(), and ShaderEffectItem::updateShaderProgram().

1890 {
1892  Q_UNUSED(d);
1893  if (location != -1)
1894  glUniform1fv(location, 1, &value);
1895 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
#define glUniform1fv

◆ setUniformValue() [2/54]

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

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

See also
setAttributeValue()

Definition at line 1918 of file qglshaderprogram.cpp.

1919 {
1921  Q_UNUSED(d);
1922  if (location != -1)
1923  glUniform1i(location, value);
1924 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniform1i
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [3/54]

void QGLShaderProgram::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.

See also
setAttributeValue()

Definition at line 1948 of file qglshaderprogram.cpp.

1949 {
1951  Q_UNUSED(d);
1952  if (location != -1)
1953  glUniform1i(location, value);
1954 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniform1i
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [4/54]

void QGLShaderProgram::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 1978 of file qglshaderprogram.cpp.

1979 {
1981  Q_UNUSED(d);
1982  if (location != -1) {
1983  GLfloat values[2] = {x, y};
1984  glUniform2fv(location, 1, values);
1985  }
1986 }
double d
Definition: qnumeric_p.h:62
#define glUniform2fv
#define Q_D(Class)
Definition: qglobal.h:2482
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [5/54]

void QGLShaderProgram::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 2011 of file qglshaderprogram.cpp.

2012 {
2014  Q_UNUSED(d);
2015  if (location != -1) {
2016  GLfloat values[3] = {x, y, z};
2017  glUniform3fv(location, 1, values);
2018  }
2019 }
double d
Definition: qnumeric_p.h:62
#define glUniform3fv
#define Q_D(Class)
Definition: qglobal.h:2482
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [6/54]

void QGLShaderProgram::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 2045 of file qglshaderprogram.cpp.

2046 {
2048  Q_UNUSED(d);
2049  if (location != -1) {
2050  GLfloat values[4] = {x, y, z, w};
2051  glUniform4fv(location, 1, values);
2052  }
2053 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
quint16 values[128]
#define glUniform4fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [7/54]

void QGLShaderProgram::setUniformValue ( int  location,
const QVector2D value 
)

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

See also
setAttributeValue()

Definition at line 2077 of file qglshaderprogram.cpp.

2078 {
2080  Q_UNUSED(d);
2081  if (location != -1)
2082  glUniform2fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
2083 }
double d
Definition: qnumeric_p.h:62
#define glUniform2fv
#define Q_D(Class)
Definition: qglobal.h:2482
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [8/54]

void QGLShaderProgram::setUniformValue ( int  location,
const QVector3D value 
)

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

See also
setAttributeValue()

Definition at line 2106 of file qglshaderprogram.cpp.

2107 {
2109  Q_UNUSED(d);
2110  if (location != -1)
2111  glUniform3fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
2112 }
double d
Definition: qnumeric_p.h:62
#define glUniform3fv
#define Q_D(Class)
Definition: qglobal.h:2482
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [9/54]

void QGLShaderProgram::setUniformValue ( int  location,
const QVector4D value 
)

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

See also
setAttributeValue()

Definition at line 2135 of file qglshaderprogram.cpp.

2136 {
2138  Q_UNUSED(d);
2139  if (location != -1)
2140  glUniform4fv(location, 1, reinterpret_cast<const GLfloat *>(&value));
2141 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniform4fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [10/54]

void QGLShaderProgram::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 2165 of file qglshaderprogram.cpp.

2166 {
2168  Q_UNUSED(d);
2169  if (location != -1) {
2170  GLfloat values[4] = {GLfloat(color.redF()), GLfloat(color.greenF()),
2171  GLfloat(color.blueF()), GLfloat(color.alphaF())};
2172  glUniform4fv(location, 1, values);
2173  }
2174 }
double d
Definition: qnumeric_p.h:62
qreal alphaF() const
Returns the alpha color component of this color.
Definition: qcolor.cpp:1106
qreal greenF() const
Returns the green color component of this color.
Definition: qcolor.cpp:1241
#define Q_D(Class)
Definition: qglobal.h:2482
quint16 values[128]
#define glUniform4fv
qreal redF() const
Returns the red color component of this color.
Definition: qcolor.cpp:1213
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
qreal blueF() const
Returns the blue color component of this color.
Definition: qcolor.cpp:1269
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [11/54]

void QGLShaderProgram::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 2198 of file qglshaderprogram.cpp.

2199 {
2201  Q_UNUSED(d);
2202  if (location != -1) {
2203  GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())};
2204  glUniform2fv(location, 1, values);
2205  }
2206 }
double d
Definition: qnumeric_p.h:62
#define glUniform2fv
#define Q_D(Class)
Definition: qglobal.h:2482
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [12/54]

void QGLShaderProgram::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 2230 of file qglshaderprogram.cpp.

2231 {
2233  Q_UNUSED(d);
2234  if (location != -1) {
2235  GLfloat values[4] = {GLfloat(point.x()), GLfloat(point.y())};
2236  glUniform2fv(location, 1, values);
2237  }
2238 }
double d
Definition: qnumeric_p.h:62
#define glUniform2fv
#define Q_D(Class)
Definition: qglobal.h:2482
qreal x() const
Returns the x-coordinate of this point.
Definition: qpoint.h:282
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
qreal y() const
Returns the y-coordinate of this point.
Definition: qpoint.h:287
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [13/54]

void QGLShaderProgram::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 2262 of file qglshaderprogram.cpp.

2263 {
2265  Q_UNUSED(d);
2266  if (location != -1) {
2267  GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())};
2268  glUniform2fv(location, 1, values);
2269  }
2270 }
double d
Definition: qnumeric_p.h:62
#define glUniform2fv
#define Q_D(Class)
Definition: qglobal.h:2482
int width() const
Returns the width.
Definition: qsize.h:126
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
int height() const
Returns the height.
Definition: qsize.h:129
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [14/54]

void QGLShaderProgram::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 2294 of file qglshaderprogram.cpp.

2295 {
2297  Q_UNUSED(d);
2298  if (location != -1) {
2299  GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())};
2300  glUniform2fv(location, 1, values);
2301  }
2302 }
double d
Definition: qnumeric_p.h:62
#define glUniform2fv
qreal width() const
Returns the width.
Definition: qsize.h:284
qreal height() const
Returns the height.
Definition: qsize.h:287
#define Q_D(Class)
Definition: qglobal.h:2482
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [15/54]

void QGLShaderProgram::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 2378 of file qglshaderprogram.cpp.

2379 {
2381  Q_UNUSED(d);
2383 }
double d
Definition: qnumeric_p.h:62
#define setUniformMatrix(func, location, value, cols, rows)
#define Q_D(Class)
Definition: qglobal.h:2482
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
#define glUniformMatrix2fv
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [16/54]

void QGLShaderProgram::setUniformValue ( int  location,
const QMatrix2x3 value 
)

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

See also
setAttributeValue()

Definition at line 2407 of file qglshaderprogram.cpp.

2408 {
2410  Q_UNUSED(d);
2412  (glUniformMatrix2x3fv, glUniform3fv, location, value, 2, 3);
2413 }
double d
Definition: qnumeric_p.h:62
#define glUniform3fv
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniformMatrix2x3fv
#define setUniformGenericMatrix(func, colfunc, location, value, cols, rows)
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [17/54]

void QGLShaderProgram::setUniformValue ( int  location,
const QMatrix2x4 value 
)

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

See also
setAttributeValue()

Definition at line 2437 of file qglshaderprogram.cpp.

2438 {
2440  Q_UNUSED(d);
2442  (glUniformMatrix2x4fv, glUniform4fv, location, value, 2, 4);
2443 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniformMatrix2x4fv
#define glUniform4fv
#define setUniformGenericMatrix(func, colfunc, location, value, cols, rows)
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [18/54]

void QGLShaderProgram::setUniformValue ( int  location,
const QMatrix3x2 value 
)

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

See also
setAttributeValue()

Definition at line 2467 of file qglshaderprogram.cpp.

2468 {
2470  Q_UNUSED(d);
2472  (glUniformMatrix3x2fv, glUniform2fv, location, value, 3, 2);
2473 }
double d
Definition: qnumeric_p.h:62
#define glUniform2fv
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniformMatrix3x2fv
#define setUniformGenericMatrix(func, colfunc, location, value, cols, rows)
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [19/54]

void QGLShaderProgram::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 2497 of file qglshaderprogram.cpp.

2498 {
2500  Q_UNUSED(d);
2502 }
double d
Definition: qnumeric_p.h:62
#define setUniformMatrix(func, location, value, cols, rows)
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniformMatrix3fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [20/54]

void QGLShaderProgram::setUniformValue ( int  location,
const QMatrix3x4 value 
)

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

See also
setAttributeValue()

Definition at line 2526 of file qglshaderprogram.cpp.

2527 {
2529  Q_UNUSED(d);
2531  (glUniformMatrix3x4fv, glUniform4fv, location, value, 3, 4);
2532 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniform4fv
#define setUniformGenericMatrix(func, colfunc, location, value, cols, rows)
#define glUniformMatrix3x4fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [21/54]

void QGLShaderProgram::setUniformValue ( int  location,
const QMatrix4x2 value 
)

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

See also
setAttributeValue()

Definition at line 2556 of file qglshaderprogram.cpp.

2557 {
2559  Q_UNUSED(d);
2561  (glUniformMatrix4x2fv, glUniform2fv, location, value, 4, 2);
2562 }
double d
Definition: qnumeric_p.h:62
#define glUniform2fv
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniformMatrix4x2fv
#define setUniformGenericMatrix(func, colfunc, location, value, cols, rows)
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [22/54]

void QGLShaderProgram::setUniformValue ( int  location,
const QMatrix4x3 value 
)

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

See also
setAttributeValue()

Definition at line 2586 of file qglshaderprogram.cpp.

2587 {
2589  Q_UNUSED(d);
2591  (glUniformMatrix4x3fv, glUniform3fv, location, value, 4, 3);
2592 }
double d
Definition: qnumeric_p.h:62
#define glUniform3fv
#define Q_D(Class)
Definition: qglobal.h:2482
#define setUniformGenericMatrix(func, colfunc, location, value, cols, rows)
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
#define glUniformMatrix4x3fv
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [23/54]

void QGLShaderProgram::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 2616 of file qglshaderprogram.cpp.

2617 {
2619  Q_UNUSED(d);
2621 }
double d
Definition: qnumeric_p.h:62
#define setUniformMatrix(func, location, value, cols, rows)
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniformMatrix4fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [24/54]

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

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

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

The matrix elements must be specified in column-major order.

See also
setAttributeValue()
Since
4.7

Definition at line 2652 of file qglshaderprogram.cpp.

2653 {
2655  Q_UNUSED(d);
2656  if (location != -1)
2657  glUniformMatrix2fv(location, 1, GL_FALSE, value[0]);
2658 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define GL_FALSE
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
#define glUniformMatrix2fv
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [25/54]

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

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

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

The matrix elements must be specified in column-major order.

See also
setAttributeValue()
Since
4.7

Definition at line 2673 of file qglshaderprogram.cpp.

2674 {
2676  Q_UNUSED(d);
2677  if (location != -1)
2678  glUniformMatrix3fv(location, 1, GL_FALSE, value[0]);
2679 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniformMatrix3fv
#define GL_FALSE
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [26/54]

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

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

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

The matrix elements must be specified in column-major order.

See also
setAttributeValue()

Definition at line 2693 of file qglshaderprogram.cpp.

2694 {
2696  Q_UNUSED(d);
2697  if (location != -1)
2698  glUniformMatrix4fv(location, 1, GL_FALSE, value[0]);
2699 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define GL_FALSE
#define glUniformMatrix4fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValue() [27/54]

void QGLShaderProgram::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 2762 of file qglshaderprogram.cpp.

2763 {
2765  Q_UNUSED(d);
2766  if (location != -1) {
2767  GLfloat mat[3][3] = {
2768  {GLfloat(value.m11()), GLfloat(value.m12()), GLfloat(value.m13())},
2769  {GLfloat(value.m21()), GLfloat(value.m22()), GLfloat(value.m23())},
2770  {GLfloat(value.m31()), GLfloat(value.m32()), GLfloat(value.m33())}
2771  };
2772  glUniformMatrix3fv(location, 1, GL_FALSE, mat[0]);
2773  }
2774 }
double d
Definition: qnumeric_p.h:62
qreal m32() const
Returns the vertical translation factor.
Definition: qtransform.h:265
qreal m21() const
Returns the horizontal shearing factor.
Definition: qtransform.h:249
qreal m22() const
Returns the vertical scaling factor.
Definition: qtransform.h:253
#define Q_D(Class)
Definition: qglobal.h:2482
qreal m12() const
Returns the vertical shearing factor.
Definition: qtransform.h:241
#define glUniformMatrix3fv
#define GL_FALSE
qreal m31() const
Returns the horizontal translation factor.
Definition: qtransform.h:261
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
qreal m23() const
Returns the vertical projection factor.
Definition: qtransform.h:257
qreal m13() const
Returns the horizontal projection factor.
Definition: qtransform.h:245
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
qreal m11() const
Returns the horizontal scaling factor.
Definition: qtransform.h:237
qreal m33() const
Returns the division factor.
Definition: qtransform.h:269

◆ setUniformValue() [28/54]

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

Sets the uniform variable called name in the current context to value.

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

See also
setAttributeValue()

Definition at line 1908 of file qglshaderprogram.cpp.

1909 {
1911 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [29/54]

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

Sets the uniform variable called name in the current context to value.

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

See also
setAttributeValue()

Definition at line 1937 of file qglshaderprogram.cpp.

1938 {
1940 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [30/54]

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

Sets the uniform variable called name in the current context to value.

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

This function should be used when setting sampler values.

See also
setAttributeValue()

Definition at line 1967 of file qglshaderprogram.cpp.

1968 {
1970 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [31/54]

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

Sets the uniform variable called name in the current context to the 2D vector (x, y).

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

See also
setAttributeValue()

Definition at line 1999 of file qglshaderprogram.cpp.

2000 {
2002 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [32/54]

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

Sets the uniform variable called name in the current context to the 3D vector (x, y, z).

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

See also
setAttributeValue()

Definition at line 2033 of file qglshaderprogram.cpp.

2034 {
2036 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [33/54]

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

Sets the uniform variable called name in the current context to the 4D vector (x, y, z, w).

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

See also
setAttributeValue()

Definition at line 2067 of file qglshaderprogram.cpp.

2068 {
2069  setUniformValue(uniformLocation(name), x, y, z, w);
2070 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [34/54]

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

Sets the uniform variable called name in the current context to value.

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

See also
setAttributeValue()

Definition at line 2096 of file qglshaderprogram.cpp.

2097 {
2099 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [35/54]

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

Sets the uniform variable called name in the current context to value.

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

See also
setAttributeValue()

Definition at line 2125 of file qglshaderprogram.cpp.

2126 {
2128 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [36/54]

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

Sets the uniform variable called name in the current context to value.

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

See also
setAttributeValue()

Definition at line 2154 of file qglshaderprogram.cpp.

2155 {
2157 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [37/54]

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

Sets the uniform variable called name in the current context to the red, green, blue, and alpha components of color.

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

See also
setAttributeValue()

Definition at line 2187 of file qglshaderprogram.cpp.

2188 {
2190 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [38/54]

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

Sets the uniform variable associated with name in the current context to the x and y coordinates of point.

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

See also
setAttributeValue()

Definition at line 2219 of file qglshaderprogram.cpp.

2220 {
2222 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [39/54]

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

Sets the uniform variable associated with name in the current context to the x and y coordinates of point.

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

See also
setAttributeValue()

Definition at line 2251 of file qglshaderprogram.cpp.

2252 {
2254 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [40/54]

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

Sets the uniform variable associated with name in the current context to the width and height of the given size.

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

See also
setAttributeValue()

Definition at line 2283 of file qglshaderprogram.cpp.

2284 {
2286 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [41/54]

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

Sets the uniform variable associated with name in the current context to the width and height of the given size.

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

See also
setAttributeValue()

Definition at line 2315 of file qglshaderprogram.cpp.

2316 {
2318 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [42/54]

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

Sets the uniform variable called name in the current context to a 2x2 matrix value.

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

See also
setAttributeValue()

Definition at line 2396 of file qglshaderprogram.cpp.

2397 {
2399 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [43/54]

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

Sets the uniform variable called name in the current context to a 2x3 matrix value.

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

See also
setAttributeValue()

Definition at line 2426 of file qglshaderprogram.cpp.

2427 {
2429 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [44/54]

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

Sets the uniform variable called name in the current context to a 2x4 matrix value.

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

See also
setAttributeValue()

Definition at line 2456 of file qglshaderprogram.cpp.

2457 {
2459 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [45/54]

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

Sets the uniform variable called name in the current context to a 3x2 matrix value.

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

See also
setAttributeValue()

Definition at line 2486 of file qglshaderprogram.cpp.

2487 {
2489 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [46/54]

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

Sets the uniform variable called name in the current context to a 3x3 matrix value.

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

See also
setAttributeValue()

Definition at line 2515 of file qglshaderprogram.cpp.

2516 {
2518 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [47/54]

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

Sets the uniform variable called name in the current context to a 3x4 matrix value.

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

See also
setAttributeValue()

Definition at line 2545 of file qglshaderprogram.cpp.

2546 {
2548 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [48/54]

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

Sets the uniform variable called name in the current context to a 4x2 matrix value.

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

See also
setAttributeValue()

Definition at line 2575 of file qglshaderprogram.cpp.

2576 {
2578 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [49/54]

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

Sets the uniform variable called name in the current context to a 4x3 matrix value.

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

See also
setAttributeValue()

Definition at line 2605 of file qglshaderprogram.cpp.

2606 {
2608 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [50/54]

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

Sets the uniform variable called name in the current context to a 4x4 matrix value.

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

See also
setAttributeValue()

Definition at line 2634 of file qglshaderprogram.cpp.

2635 {
2637 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [51/54]

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

Sets the uniform variable called name in the current context to a 2x2 matrix value.

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

The matrix elements must be specified in column-major order.

See also
setAttributeValue()
Since
4.7

Definition at line 2715 of file qglshaderprogram.cpp.

2716 {
2718 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [52/54]

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

Sets the uniform variable called name in the current context to a 3x3 matrix value.

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

The matrix elements must be specified in column-major order.

See also
setAttributeValue()
Since
4.7

Definition at line 2733 of file qglshaderprogram.cpp.

2734 {
2736 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [53/54]

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

Sets the uniform variable called name in the current context to a 4x4 matrix value.

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

The matrix elements must be specified in column-major order.

See also
setAttributeValue()

Definition at line 2750 of file qglshaderprogram.cpp.

2751 {
2753 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValue() [54/54]

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

Sets the uniform variable called name in the current context to a 3x3 transformation matrix value that is specified as a QTransform value.

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

To set a QTransform value as a 4x4 matrix in a shader, use setUniformValue(name, QMatrix4x4(value)).

Definition at line 2789 of file qglshaderprogram.cpp.

2790 {
2792 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * name
void setUniformValue(int location, GLfloat value)
Sets the uniform variable at location in the current context to value.

◆ setUniformValueArray() [1/30]

void QGLShaderProgram::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 2865 of file qglshaderprogram.cpp.

Referenced by QGLShader::hasOpenGLShaders(), QGLPixmapConvolutionFilter::setUniforms(), and setUniformValueArray().

2866 {
2868  Q_UNUSED(d);
2869  if (location != -1) {
2870  if (tupleSize == 1)
2871  glUniform1fv(location, count, values);
2872  else if (tupleSize == 2)
2873  glUniform2fv(location, count, values);
2874  else if (tupleSize == 3)
2875  glUniform3fv(location, count, values);
2876  else if (tupleSize == 4)
2877  glUniform4fv(location, count, values);
2878  else
2879  qWarning() << "QGLShaderProgram::setUniformValue: size" << tupleSize << "not supported";
2880  }
2881 }
double d
Definition: qnumeric_p.h:62
#define glUniform3fv
#define glUniform2fv
#define Q_D(Class)
Definition: qglobal.h:2482
Q_CORE_EXPORT void qWarning(const char *,...)
quint16 values[128]
#define glUniform4fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
#define glUniform1fv

◆ setUniformValueArray() [2/30]

void QGLShaderProgram::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 2800 of file qglshaderprogram.cpp.

2801 {
2803  Q_UNUSED(d);
2804  if (location != -1)
2805  glUniform1iv(location, count, values);
2806 }
double d
Definition: qnumeric_p.h:62
#define glUniform1iv
#define Q_D(Class)
Definition: qglobal.h:2482
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [3/30]

void QGLShaderProgram::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.

See also
setAttributeValue()

Definition at line 2832 of file qglshaderprogram.cpp.

2833 {
2835  Q_UNUSED(d);
2836  if (location != -1)
2837  glUniform1iv(location, count, reinterpret_cast<const GLint *>(values));
2838 }
double d
Definition: qnumeric_p.h:62
#define glUniform1iv
#define Q_D(Class)
Definition: qglobal.h:2482
quint16 values[128]
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [4/30]

void QGLShaderProgram::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 2907 of file qglshaderprogram.cpp.

2908 {
2910  Q_UNUSED(d);
2911  if (location != -1)
2912  glUniform2fv(location, count, reinterpret_cast<const GLfloat *>(values));
2913 }
double d
Definition: qnumeric_p.h:62
#define glUniform2fv
#define Q_D(Class)
Definition: qglobal.h:2482
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [5/30]

void QGLShaderProgram::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 2937 of file qglshaderprogram.cpp.

2938 {
2940  Q_UNUSED(d);
2941  if (location != -1)
2942  glUniform3fv(location, count, reinterpret_cast<const GLfloat *>(values));
2943 }
double d
Definition: qnumeric_p.h:62
#define glUniform3fv
#define Q_D(Class)
Definition: qglobal.h:2482
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [6/30]

void QGLShaderProgram::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 2967 of file qglshaderprogram.cpp.

2968 {
2970  Q_UNUSED(d);
2971  if (location != -1)
2972  glUniform4fv(location, count, reinterpret_cast<const GLfloat *>(values));
2973 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniform4fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [7/30]

void QGLShaderProgram::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 3058 of file qglshaderprogram.cpp.

3059 {
3061  Q_UNUSED(d);
3063  (glUniformMatrix2fv, location, values, count, QMatrix2x2, 2, 2);
3064 }
double d
Definition: qnumeric_p.h:62
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N colum...
#define setUniformMatrixArray(func, location, values, count, type, cols, rows)
#define Q_D(Class)
Definition: qglobal.h:2482
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
#define glUniformMatrix2fv
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [8/30]

void QGLShaderProgram::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 3088 of file qglshaderprogram.cpp.

3089 {
3091  Q_UNUSED(d);
3093  (glUniformMatrix2x3fv, glUniform3fv, location, values, count,
3094  QMatrix2x3, 2, 3);
3095 }
double d
Definition: qnumeric_p.h:62
#define glUniform3fv
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N colum...
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniformMatrix2x3fv
#define setUniformGenericMatrixArray(func, colfunc, location, values, count, type, cols, rows)
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [9/30]

void QGLShaderProgram::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 3119 of file qglshaderprogram.cpp.

3120 {
3122  Q_UNUSED(d);
3124  (glUniformMatrix2x4fv, glUniform4fv, location, values, count,
3125  QMatrix2x4, 2, 4);
3126 }
double d
Definition: qnumeric_p.h:62
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N colum...
#define Q_D(Class)
Definition: qglobal.h:2482
#define setUniformGenericMatrixArray(func, colfunc, location, values, count, type, cols, rows)
#define glUniformMatrix2x4fv
#define glUniform4fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [10/30]

void QGLShaderProgram::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 3150 of file qglshaderprogram.cpp.

3151 {
3153  Q_UNUSED(d);
3155  (glUniformMatrix3x2fv, glUniform2fv, location, values, count,
3156  QMatrix3x2, 3, 2);
3157 }
double d
Definition: qnumeric_p.h:62
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N colum...
#define glUniform2fv
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniformMatrix3x2fv
#define setUniformGenericMatrixArray(func, colfunc, location, values, count, type, cols, rows)
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [11/30]

void QGLShaderProgram::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 3181 of file qglshaderprogram.cpp.

3182 {
3184  Q_UNUSED(d);
3186  (glUniformMatrix3fv, location, values, count, QMatrix3x3, 3, 3);
3187 }
double d
Definition: qnumeric_p.h:62
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N colum...
#define setUniformMatrixArray(func, location, values, count, type, cols, rows)
#define Q_D(Class)
Definition: qglobal.h:2482
#define glUniformMatrix3fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [12/30]

void QGLShaderProgram::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 3211 of file qglshaderprogram.cpp.

3212 {
3214  Q_UNUSED(d);
3216  (glUniformMatrix3x4fv, glUniform4fv, location, values, count,
3217  QMatrix3x4, 3, 4);
3218 }
double d
Definition: qnumeric_p.h:62
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N colum...
#define Q_D(Class)
Definition: qglobal.h:2482
#define setUniformGenericMatrixArray(func, colfunc, location, values, count, type, cols, rows)
#define glUniform4fv
#define glUniformMatrix3x4fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [13/30]

void QGLShaderProgram::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 3242 of file qglshaderprogram.cpp.

3243 {
3245  Q_UNUSED(d);
3247  (glUniformMatrix4x2fv, glUniform2fv, location, values, count,
3248  QMatrix4x2, 4, 2);
3249 }
double d
Definition: qnumeric_p.h:62
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N colum...
#define glUniform2fv
#define Q_D(Class)
Definition: qglobal.h:2482
#define setUniformGenericMatrixArray(func, colfunc, location, values, count, type, cols, rows)
#define glUniformMatrix4x2fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [14/30]

void QGLShaderProgram::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 3273 of file qglshaderprogram.cpp.

3274 {
3276  Q_UNUSED(d);
3278  (glUniformMatrix4x3fv, glUniform3fv, location, values, count,
3279  QMatrix4x3, 4, 3);
3280 }
double d
Definition: qnumeric_p.h:62
#define glUniform3fv
The QGenericMatrix class is a template class that represents a NxM transformation matrix with N colum...
#define Q_D(Class)
Definition: qglobal.h:2482
#define setUniformGenericMatrixArray(func, colfunc, location, values, count, type, cols, rows)
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
#define glUniformMatrix4x3fv
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [15/30]

void QGLShaderProgram::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 3304 of file qglshaderprogram.cpp.

3305 {
3307  Q_UNUSED(d);
3309  (glUniformMatrix4fv, location, values, count, QMatrix4x4, 4, 4);
3310 }
double d
Definition: qnumeric_p.h:62
#define setUniformMatrixArray(func, location, values, count, type, cols, rows)
#define Q_D(Class)
Definition: qglobal.h:2482
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
Definition: qmatrix4x4.h:63
#define glUniformMatrix4fv
static QTestResult::TestLocation location
Definition: qtestresult.cpp:63
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ setUniformValueArray() [16/30]

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

Sets the uniform variable array called name in the current context to the count elements of values.

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

Each element has tupleSize components. The tupleSize must be 1, 2, 3, or 4.

See also
setAttributeValue()

Definition at line 2896 of file qglshaderprogram.cpp.

2897 {
2898  setUniformValueArray(uniformLocation(name), values, count, tupleSize);
2899 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name
quint16 values[128]

◆ setUniformValueArray() [17/30]

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

Sets the uniform variable array called name in the current context to the count elements of values.

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

See also
setAttributeValue()

Definition at line 2820 of file qglshaderprogram.cpp.

2821 {
2823 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name
quint16 values[128]

◆ setUniformValueArray() [18/30]

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

Sets the uniform variable array called name in the current context to the count elements of values.

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

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

See also
setAttributeValue()

Definition at line 2853 of file qglshaderprogram.cpp.

2854 {
2856 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name
quint16 values[128]

◆ setUniformValueArray() [19/30]

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

Sets the uniform variable array called name in the current context to the count 2D vector elements of values.

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

See also
setAttributeValue()

Definition at line 2926 of file qglshaderprogram.cpp.

2927 {
2928  setUniformValueArray(uniformLocation(name), values, count);
2929 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name

◆ setUniformValueArray() [20/30]

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

Sets the uniform variable array called name in the current context to the count 3D vector elements of values.

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

See also
setAttributeValue()

Definition at line 2956 of file qglshaderprogram.cpp.

2957 {
2958  setUniformValueArray(uniformLocation(name), values, count);
2959 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name

◆ setUniformValueArray() [21/30]

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

Sets the uniform variable array called name in the current context to the count 4D vector elements of values.

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

See also
setAttributeValue()

Definition at line 2986 of file qglshaderprogram.cpp.

2987 {
2988  setUniformValueArray(uniformLocation(name), values, count);
2989 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name

◆ setUniformValueArray() [22/30]

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

Sets the uniform variable array called name in the current context to the count 2x2 matrix elements of values.

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

See also
setAttributeValue()

Definition at line 3077 of file qglshaderprogram.cpp.

3078 {
3079  setUniformValueArray(uniformLocation(name), values, count);
3080 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name

◆ setUniformValueArray() [23/30]

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

Sets the uniform variable array called name in the current context to the count 2x3 matrix elements of values.

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

See also
setAttributeValue()

Definition at line 3108 of file qglshaderprogram.cpp.

3109 {
3110  setUniformValueArray(uniformLocation(name), values, count);
3111 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name

◆ setUniformValueArray() [24/30]

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

Sets the uniform variable array called name in the current context to the count 2x4 matrix elements of values.

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

See also
setAttributeValue()

Definition at line 3139 of file qglshaderprogram.cpp.

3140 {
3141  setUniformValueArray(uniformLocation(name), values, count);
3142 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name

◆ setUniformValueArray() [25/30]

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

Sets the uniform variable array called name in the current context to the count 3x2 matrix elements of values.

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

See also
setAttributeValue()

Definition at line 3170 of file qglshaderprogram.cpp.

3171 {
3172  setUniformValueArray(uniformLocation(name), values, count);
3173 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name

◆ setUniformValueArray() [26/30]

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

Sets the uniform variable array called name in the current context to the count 3x3 matrix elements of values.

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

See also
setAttributeValue()

Definition at line 3200 of file qglshaderprogram.cpp.

3201 {
3202  setUniformValueArray(uniformLocation(name), values, count);
3203 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name

◆ setUniformValueArray() [27/30]

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

Sets the uniform variable array called name in the current context to the count 3x4 matrix elements of values.

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

See also
setAttributeValue()

Definition at line 3231 of file qglshaderprogram.cpp.

3232 {
3233  setUniformValueArray(uniformLocation(name), values, count);
3234 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name

◆ setUniformValueArray() [28/30]

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

Sets the uniform variable array called name in the current context to the count 4x2 matrix elements of values.

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

See also
setAttributeValue()

Definition at line 3262 of file qglshaderprogram.cpp.

3263 {
3264  setUniformValueArray(uniformLocation(name), values, count);
3265 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name

◆ setUniformValueArray() [29/30]

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

Sets the uniform variable array called name in the current context to the count 4x3 matrix elements of values.

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

See also
setAttributeValue()

Definition at line 3293 of file qglshaderprogram.cpp.

3294 {
3295  setUniformValueArray(uniformLocation(name), values, count);
3296 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name

◆ setUniformValueArray() [30/30]

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

Sets the uniform variable array called name in the current context to the count 4x4 matrix elements of values.

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

See also
setAttributeValue()

Definition at line 3323 of file qglshaderprogram.cpp.

3324 {
3325  setUniformValueArray(uniformLocation(name), values, count);
3326 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
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...
const char * name

◆ shaderDestroyed

void QGLShaderProgram::shaderDestroyed ( )
privateslot
Warning
This function is not part of the public interface.

Definition at line 3456 of file qglshaderprogram.cpp.

Referenced by addShader(), and removeShader().

3457 {
3459  QGLShader *shader = qobject_cast<QGLShader *>(sender());
3460  if (shader && !d->removingShaders)
3461  removeShader(shader);
3462 }
double d
Definition: qnumeric_p.h:62
T * qobject_cast(QObject *object)
Definition: qobject.h:375
#define Q_D(Class)
Definition: qglobal.h:2482
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
Definition: qobject.cpp:2327
The QGLShader class allows OpenGL shaders to be compiled.
void removeShader(QGLShader *shader)
Removes shader from this shader program.
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ shaders()

QList< QGLShader * > QGLShaderProgram::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 833 of file qglshaderprogram.cpp.

Referenced by QGLEngineSharedShaders::findProgramInCache().

834 {
835  Q_D(const QGLShaderProgram);
836  return d->shaders;
837 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.

◆ uniformLocation() [1/3]

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

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

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

See also
attributeLocation()

Definition at line 1837 of file qglshaderprogram.cpp.

Referenced by QGLEngineSharedShaders::findProgramInCache(), QGLEngineShaderManager::getUniformLocation(), setUniformValue(), setUniformValueArray(), and uniformLocation().

1838 {
1839  Q_D(const QGLShaderProgram);
1840  Q_UNUSED(d);
1841  if (d->linked) {
1842  return glGetUniformLocation(d->programGuard.id(), name);
1843  } else {
1844  qWarning() << "QGLShaderProgram::uniformLocation(" << name
1845  << "): shader program is not linked";
1846  return -1;
1847  }
1848 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
const char * name
Q_CORE_EXPORT void qWarning(const char *,...)
#define glGetUniformLocation
The QGLShaderProgram class allows OpenGL shader programs to be linked and used.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ uniformLocation() [2/3]

int QGLShaderProgram::uniformLocation ( const QByteArray name) const

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

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

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

See also
attributeLocation()

Definition at line 1862 of file qglshaderprogram.cpp.

1863 {
1864  return uniformLocation(name.constData());
1865 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433

◆ uniformLocation() [3/3]

int QGLShaderProgram::uniformLocation ( const QString name) const

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

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

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

See also
attributeLocation()

Definition at line 1879 of file qglshaderprogram.cpp.

1880 {
1881  return uniformLocation(name.toLatin1().constData());
1882 }
int uniformLocation(const char *name) const
Returns the location of the uniform variable name within this shader program&#39;s parameter list...
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433

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