|  | Home · All Classes · Modules

# QGLShaderProgram Class Reference
[QtOpenGL module]

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

Inherits QObject.

### Methods

- __init__ (self, QObject parent = None)
- __init__ (self, QGLContext, QObject parent = None)
- bool addShader (self, QGLShader)
- bool addShaderFromSourceCode (self, QGLShader.ShaderType, QByteArray)
- bool addShaderFromSourceCode (self, QGLShader.ShaderType, QString)
- bool addShaderFromSourceFile (self, QGLShader.ShaderType, QString)
- int attributeLocation (self, QByteArray)
- int attributeLocation (self, QString)
- bool bind (self)
- bindAttributeLocation (self, QByteArray, int)
- bindAttributeLocation (self, QString, int)
- disableAttributeArray (self, int)
- disableAttributeArray (self, str)
- enableAttributeArray (self, int)
- enableAttributeArray (self, str)
- bool isLinked (self)
- bool link (self)
- QString log (self)
- int programId (self)
- release (self)
- removeAllShaders (self)
- removeShader (self, QGLShader)
- setAttributeValue (self, int, float)
- setAttributeValue (self, int, float, float)
- setAttributeValue (self, int, float, float, float)
- setAttributeValue (self, int, float, float, float, float)
- setAttributeValue (self, int, QVector2D)
- setAttributeValue (self, int, QVector3D)
- setAttributeValue (self, int, QVector4D)
- setAttributeValue (self, int, QColor)
- setAttributeValue (self, str, float)
- setAttributeValue (self, str, float, float)
- setAttributeValue (self, str, float, float, float)
- setAttributeValue (self, str, float, float, float, float)
- setAttributeValue (self, str, QVector2D)
- setAttributeValue (self, str, QVector3D)
- setAttributeValue (self, str, QVector4D)
- setAttributeValue (self, str, QColor)
- setUniformValue (self, int, int)
- setUniformValue (self, int, float)
- setUniformValue (self, int, float, float)
- setUniformValue (self, int, float, float, float)
- setUniformValue (self, int, float, float, float, float)
- setUniformValue (self, int, QVector2D)
- setUniformValue (self, int, QVector3D)
- setUniformValue (self, int, QVector4D)
- setUniformValue (self, int, QColor)
- setUniformValue (self, int, QPoint)
- setUniformValue (self, int, QPointF)
- setUniformValue (self, int, QSize)
- setUniformValue (self, int, QSizeF)
- setUniformValue (self, int, QMatrix2x2)
- setUniformValue (self, int, QMatrix2x3)
- setUniformValue (self, int, QMatrix2x4)
- setUniformValue (self, int, QMatrix3x2)
- setUniformValue (self, int, QMatrix3x3)
- setUniformValue (self, int, QMatrix3x4)
- setUniformValue (self, int, QMatrix4x2)
- setUniformValue (self, int, QMatrix4x3)
- setUniformValue (self, int, QMatrix4x4)
- setUniformValue (self, int, QTransform)
- setUniformValue (self, str, int)
- setUniformValue (self, str, float)
- setUniformValue (self, str, float, float)
- setUniformValue (self, str, float, float, float)
- setUniformValue (self, str, float, float, float, float)
- setUniformValue (self, str, QVector2D)
- setUniformValue (self, str, QVector3D)
- setUniformValue (self, str, QVector4D)
- setUniformValue (self, str, QColor)
- setUniformValue (self, str, QPoint)
- setUniformValue (self, str, QPointF)
- setUniformValue (self, str, QSize)
- setUniformValue (self, str, QSizeF)
- setUniformValue (self, str, QMatrix2x2)
- setUniformValue (self, str, QMatrix2x3)
- setUniformValue (self, str, QMatrix2x4)
- setUniformValue (self, str, QMatrix3x2)
- setUniformValue (self, str, QMatrix3x3)
- setUniformValue (self, str, QMatrix3x4)
- setUniformValue (self, str, QMatrix4x2)
- setUniformValue (self, str, QMatrix4x3)
- setUniformValue (self, str, QMatrix4x4)
- setUniformValue (self, str, QTransform)
- list-of-QGLShader shaders (self)
- int uniformLocation (self, QByteArray)
- int uniformLocation (self, QString)

### Static Methods

- bool hasOpenGLShaderPrograms (QGLContext context = None)

## Detailed Description

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

### 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():

     QGLShader shader(QGLShader.Vertex);
     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"
         "attribute mediump 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.attributeLocation("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.

## Method Documentation

### QGLShaderProgram.__init__ (self, QObject parent = None)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

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

### QGLShaderProgram.__init__ (self, QGLContext, QObject parent = None)

The parent argument, if not None, causes self to be owned by Qt instead of PyQt.

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

### bool QGLShaderProgram.addShader (self, QGLShader)

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

### bool QGLShaderProgram.addShaderFromSourceCode (self, QGLShader.ShaderType, QByteArray)

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

### bool QGLShaderProgram.addShaderFromSourceCode (self, QGLShader.ShaderType, QString)

This is an overloaded function.

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

### bool QGLShaderProgram.addShaderFromSourceFile (self, QGLShader.ShaderType, QString)

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() and addShaderFromSourceCode().

### int QGLShaderProgram.attributeLocation (self, QByteArray)

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() and bindAttributeLocation().

### int QGLShaderProgram.attributeLocation (self, QString)

This is an overloaded function.

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() and bindAttributeLocation().

### bool QGLShaderProgram.bind (self)

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() and release().

### QGLShaderProgram.bindAttributeLocation (self, QByteArray, int)

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.

See also attributeLocation().

### QGLShaderProgram.bindAttributeLocation (self, QString, int)

This is an overloaded function.

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.

See also attributeLocation().

### QGLShaderProgram.disableAttributeArray (self, int)

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

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

### QGLShaderProgram.disableAttributeArray (self, str)

This is an overloaded function.

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

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

### QGLShaderProgram.enableAttributeArray (self, int)

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

### QGLShaderProgram.enableAttributeArray (self, str)

This is an overloaded function.

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

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

### bool QGLShaderProgram.hasOpenGLShaderPrograms (QGLContext context = None)

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.

### bool QGLShaderProgram.isLinked (self)

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

See also link().

### bool QGLShaderProgram.link (self)

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() and log().

### QString QGLShaderProgram.log (self)

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

See also link().

### int QGLShaderProgram.programId (self)

Returns the OpenGL identifier associated with this shader program.

See also QGLShader.shaderId().

### QGLShaderProgram.release (self)

Releases the active shader program from the current QGLContext. This is equivalent to calling `glUseProgram(0)`.

See also bind().

### QGLShaderProgram.removeAllShaders (self)

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() and removeShader().

### QGLShaderProgram.removeShader (self, QGLShader)

Removes shader from this shader program. The object is not deleted.

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

### QGLShaderProgram.setAttributeValue (self, int, float)

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, int, float, float)

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, int, float, float, float)

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, int, float, float, float, float)

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, int, QVector2D)

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, int, QVector3D)

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, int, QVector4D)

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, int, QColor)

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, str, float)

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

### QGLShaderProgram.setAttributeValue (self, str, float, float)

This is an overloaded function.

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, str, float, float, float)

This is an overloaded function.

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, str, float, float, float, float)

This is an overloaded function.

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, str, QVector2D)

This is an overloaded function.

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, str, QVector3D)

This is an overloaded function.

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, str, QVector4D)

This is an overloaded function.

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

See also setUniformValue().

### QGLShaderProgram.setAttributeValue (self, str, QColor)

This is an overloaded function.

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

See also setUniformValue().

### QGLShaderProgram.setUniformValue (self, int, int)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, float)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, float, float)

Sets the uniform variable at location in the current context to value. This function should be used when setting sampler values.

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, float, float, float)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, float, float, float, float)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QVector2D)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QVector3D)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QVector4D)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QColor)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QPoint)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QPointF)

Sets the uniform variable at location in the current context to the x and y coordinates of point.

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QSize)

Sets the uniform variable at location in the current context to the x and y coordinates of point.

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QSizeF)

Sets the uniform variable at location in the current context to the width and height of the given size.

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QMatrix2x2)

Sets the uniform variable at location in the current context to the width and height of the given size.

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QMatrix2x3)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QMatrix2x4)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QMatrix3x2)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QMatrix3x3)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QMatrix3x4)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QMatrix4x2)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QMatrix4x3)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QMatrix4x4)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, int, QTransform)

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, int)

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

### QGLShaderProgram.setUniformValue (self, str, float)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, float, float)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, float, float, float)

This is an overloaded function.

Sets the uniform variable called name in the current context to value. This function should be used when setting sampler values.

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, float, float, float, float)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QVector2D)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QVector3D)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QVector4D)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QColor)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QPoint)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QPointF)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QSize)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QSizeF)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QMatrix2x2)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QMatrix2x3)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QMatrix2x4)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QMatrix3x2)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QMatrix3x3)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QMatrix3x4)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QMatrix4x2)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QMatrix4x3)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QMatrix4x4)

This is an overloaded function.

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

See also setAttributeValue().

### QGLShaderProgram.setUniformValue (self, str, QTransform)

This is an overloaded function.

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

See also setAttributeValue().

### list-of-QGLShader QGLShaderProgram.shaders (self)

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

See also addShader() and removeShader().

### int QGLShaderProgram.uniformLocation (self, QByteArray)

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

### int QGLShaderProgram.uniformLocation (self, QString)

This is an overloaded function.

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