QGLShaderProgram¶
The
QGLShaderProgramclass allows OpenGL shader programs to be linked and used. More…

New in version 4.6.
Synopsis¶
Functions¶
def
addShader(shader)def
addShaderFromSourceCode(type, source)def
addShaderFromSourceCode(type, source)def
addShaderFromSourceCode(type, source)def
addShaderFromSourceFile(type, fileName)def
attributeLocation(name)def
attributeLocation(name)def
attributeLocation(name)def
bind()def
bindAttributeLocation(name, location)def
bindAttributeLocation(name, location)def
bindAttributeLocation(name, location)def
disableAttributeArray(location)def
disableAttributeArray(name)def
enableAttributeArray(location)def
enableAttributeArray(name)def
geometryInputType()def
geometryOutputType()def
geometryOutputVertexCount()def
isLinked()def
log()def
maxGeometryOutputVertices()def
programId()def
release()def
removeAllShaders()def
removeShader(shader)def
setAttributeArray2D(location, values[, stride=0])def
setAttributeArray2D(name, values[, stride=0])def
setAttributeArray3D(location, values[, stride=0])def
setAttributeArray3D(name, values[, stride=0])def
setAttributeArray4D(location, values[, stride=0])def
setAttributeArray4D(name, values[, stride=0])def
setAttributeBuffer(location, type, offset, tupleSize[, stride=0])def
setAttributeBuffer(name, type, offset, tupleSize[, stride=0])def
setAttributeValue(location, value)def
setAttributeValue(location, value)def
setAttributeValue(location, value)def
setAttributeValue(location, value)def
setAttributeValue(location, value)def
setAttributeValue(location, x, y)def
setAttributeValue(location, x, y, z)def
setAttributeValue(location, x, y, z, w)def
setAttributeValue(name, value)def
setAttributeValue(name, value)def
setAttributeValue(name, value)def
setAttributeValue(name, value)def
setAttributeValue(name, value)def
setAttributeValue(name, x, y)def
setAttributeValue(name, x, y, z)def
setAttributeValue(name, x, y, z, w)def
setGeometryInputType(inputType)def
setGeometryOutputType(outputType)def
setGeometryOutputVertexCount(count)def
setUniformValue(location, color)def
setUniformValue(location, point)def
setUniformValue(location, point)def
setUniformValue(location, size)def
setUniformValue(location, size)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, value)def
setUniformValue(location, x, y)def
setUniformValue(location, x, y, z)def
setUniformValue(location, x, y, z, w)def
setUniformValue(name, color)def
setUniformValue(name, point)def
setUniformValue(name, point)def
setUniformValue(name, size)def
setUniformValue(name, size)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, value)def
setUniformValue(name, x, y)def
setUniformValue(name, x, y, z)def
setUniformValue(name, x, y, z, w)def
setUniformValueArray2D(location, values)def
setUniformValueArray2D(name, values)def
setUniformValueArray2x2(location, values)def
setUniformValueArray2x2(name, values)def
setUniformValueArray2x3(location, values)def
setUniformValueArray2x3(name, values)def
setUniformValueArray2x4(location, values)def
setUniformValueArray2x4(name, values)def
setUniformValueArray3D(location, values)def
setUniformValueArray3D(name, values)def
setUniformValueArray3x2(location, values)def
setUniformValueArray3x2(name, values)def
setUniformValueArray3x3(location, values)def
setUniformValueArray3x3(name, values)def
setUniformValueArray3x4(location, values)def
setUniformValueArray3x4(name, values)def
setUniformValueArray4D(location, values)def
setUniformValueArray4D(name, values)def
setUniformValueArray4x2(location, values)def
setUniformValueArray4x2(name, values)def
setUniformValueArray4x3(location, values)def
setUniformValueArray4x3(name, values)def
setUniformValueArray4x4(location, values)def
setUniformValueArray4x4(name, values)def
setUniformValueArrayInt(location, values)def
setUniformValueArrayInt(name, values)def
setUniformValueArrayUint(location, values)def
setUniformValueArrayUint(name, values)def
shaders()def
uniformLocation(name)def
uniformLocation(name)def
uniformLocation(name)
Virtual functions¶
def
link()
Static functions¶
def
hasOpenGLShaderPrograms([context=None])
Detailed Description¶
Introduction¶
This class supports shader programs written in the OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES).
QGLShaderandQGLShaderProgramshelter 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 currentQGLContextby callingbind():shader = QGLShader(QGLShader.Vertex) shader.compileSourceCode(code) program = QGLShaderProgram(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 qualifiershighp,mediump, andlowp.The
QGLShaderProgramclass 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 lowpThis 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() vertexLocation = program.attributeLocation("vertex") matrixLocation = program.attributeLocation("matrix") colorLocation = program.uniformLocation("color")With the above shader program active, we can draw a green triangle as follows:
triangleVertices = ( 60.0f, 10.0f, 0.0f, 110.0f, 110.0f, 0.0f, 10.0f, 110.0f, 0.0f) color = QColor(0, 255, 0, 255) pmvMatrix = QMatrix4x4() pmvMatrix.ortho(self.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 fromshaderId(). TheQGLShaderinstance containing the binary can then be added to the shader program withaddShader()and linked in the usual fashion withlink().Binary programs may be specified using
glProgramBinaryOES()on the return value fromprogramId(). Then the application should calllink(), which will notice that the program has already been specified and linked, allowing other operations to be performed on the shader program.Note
This class has been deprecated in favor of
QOpenGLShaderProgram.See also
- class PySide2.QtOpenGL.QGLShaderProgram([parent=None])¶
PySide2.QtOpenGL.QGLShaderProgram(context[, parent=None])
- param parent:
- param context:
Constructs a new shader program and attaches it to
parent. The program will be invalid untiladdShader()is called.The shader program will be associated with the current
QGLContext.See also
Constructs a new shader program and attaches it to
parent. The program will be invalid untiladdShader()is called.The shader program will be associated with
context.See also
- PySide2.QtOpenGL.QGLShaderProgram.addShader(shader)¶
- Parameters:
shader –
PySide2.QtOpenGL.QGLShader- Return type:
bool
Adds a compiled
shaderto this shader program. Returnstrueif the shader could be added, or false otherwise.Ownership of the
shaderobject remains with the caller. It will not be deleted when thisQGLShaderPrograminstance is deleted. This allows the caller to add the same shader to multiple shader programs.
- PySide2.QtOpenGL.QGLShaderProgram.addShaderFromSourceCode(type, source)¶
- Parameters:
type –
ShaderTypesource –
PySide2.QtCore.QByteArray
- Return type:
bool
- PySide2.QtOpenGL.QGLShaderProgram.addShaderFromSourceCode(type, source)
- Parameters:
type –
ShaderTypesource – str
- Return type:
bool
Compiles
sourceas a shader of the specifiedtypeand adds it to this shader program. Returnstrueif compilation was successful, false otherwise. The compilation errors and warnings will be made available vialog().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
QGLShaderfirst.
- PySide2.QtOpenGL.QGLShaderProgram.addShaderFromSourceCode(type, source)
- Parameters:
type –
ShaderTypesource – str
- Return type:
bool
- PySide2.QtOpenGL.QGLShaderProgram.addShaderFromSourceFile(type, fileName)¶
- Parameters:
type –
ShaderTypefileName – str
- Return type:
bool
Compiles the contents of
fileNameas a shader of the specifiedtypeand adds it to this shader program. Returnstrueif compilation was successful, false otherwise. The compilation errors and warnings will be made available vialog().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
QGLShaderfirst.See also
- PySide2.QtOpenGL.QGLShaderProgram.attributeLocation(name)¶
- Parameters:
name –
PySide2.QtCore.QByteArray- Return type:
int
- PySide2.QtOpenGL.QGLShaderProgram.attributeLocation(name)
- Parameters:
name – str
- Return type:
int
- PySide2.QtOpenGL.QGLShaderProgram.attributeLocation(name)
- Parameters:
name – str
- Return type:
int
Returns the location of the attribute
namewithin this shader program’s parameter list. Returns -1 ifnameis not a valid attribute for this shader program.See also
- PySide2.QtOpenGL.QGLShaderProgram.bind()¶
- Return type:
bool
Binds this shader program to the active
QGLContextand makes it the current shader program. Any previously bound shader program is released. This is equivalent to callingglUseProgram()onprogramId(). Returnstrueif 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 calllink().
- PySide2.QtOpenGL.QGLShaderProgram.bindAttributeLocation(name, location)¶
- Parameters:
name –
PySide2.QtCore.QByteArraylocation – int
- PySide2.QtOpenGL.QGLShaderProgram.bindAttributeLocation(name, location)
- Parameters:
name – str
location – int
- PySide2.QtOpenGL.QGLShaderProgram.bindAttributeLocation(name, location)
- Parameters:
name – str
location – int
Binds the attribute
nameto the specifiedlocation. 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
- PySide2.QtOpenGL.QGLShaderProgram.disableAttributeArray(name)¶
- Parameters:
name – str
This is an overloaded function.
Disables the vertex array called
namein this shader program that was enabled by a previous call toenableAttributeArray().See also
enableAttributeArray()setAttributeArray()setAttributeValue()setUniformValue()
- PySide2.QtOpenGL.QGLShaderProgram.disableAttributeArray(location)
- Parameters:
location – int
Disables the vertex array at
locationin this shader program that was enabled by a previous call toenableAttributeArray().See also
enableAttributeArray()setAttributeArray()setAttributeValue()setUniformValue()
- PySide2.QtOpenGL.QGLShaderProgram.enableAttributeArray(name)¶
- Parameters:
name – str
This is an overloaded function.
Enables the vertex array called
namein this shader program so that the value set bysetAttributeArray()onnamewill be used by the shader program.See also
disableAttributeArray()setAttributeArray()setAttributeValue()setUniformValue()
- PySide2.QtOpenGL.QGLShaderProgram.enableAttributeArray(location)
- Parameters:
location – int
Enables the vertex array at
locationin this shader program so that the value set bysetAttributeArray()onlocationwill be used by the shader program.See also
disableAttributeArray()setAttributeArray()setAttributeValue()setUniformValue()
- PySide2.QtOpenGL.QGLShaderProgram.geometryInputType()¶
- Return type:
GLenum
Returns the geometry shader input type, if active.
This parameter takes effect the next time the program is linked.
See also
- PySide2.QtOpenGL.QGLShaderProgram.geometryOutputType()¶
- Return type:
GLenum
Returns the geometry shader output type, if active.
This parameter takes effect the next time the program is linked.
See also
- PySide2.QtOpenGL.QGLShaderProgram.geometryOutputVertexCount()¶
- Return type:
int
Returns the maximum number of vertices the current geometry shader program will produce, if active.
This parameter takes effect the ntext time the program is linked.
See also
- static PySide2.QtOpenGL.QGLShaderProgram.hasOpenGLShaderPrograms([context=None])¶
- Parameters:
context –
PySide2.QtOpenGL.QGLContext- Return type:
bool
Returns
trueif shader programs written in the OpenGL Shading Language (GLSL) are supported on this system; false otherwise.The
contextis used to resolve the GLSL extensions. IfcontextisNone, thencurrentContext()is used.
- PySide2.QtOpenGL.QGLShaderProgram.isLinked()¶
- Return type:
bool
Returns
trueif this shader program has been linked; false otherwise.See also
- PySide2.QtOpenGL.QGLShaderProgram.link()¶
- Return type:
bool
Links together the shaders that were added to this program with
addShader(). Returnstrueif the link was successful or false otherwise. If the link failed, the error messages can be retrieved withlog().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
- PySide2.QtOpenGL.QGLShaderProgram.log()¶
- Return type:
str
Returns the errors and warnings that occurred during the last
link()oraddShader()with explicitly specified source code.See also
- PySide2.QtOpenGL.QGLShaderProgram.maxGeometryOutputVertices()¶
- Return type:
int
Returns the hardware limit for how many vertices a geometry shader can output.
See also
- PySide2.QtOpenGL.QGLShaderProgram.programId()¶
- Return type:
GLuint
Returns the OpenGL identifier associated with this shader program.
See also
- PySide2.QtOpenGL.QGLShaderProgram.release()¶
Releases the active shader program from the current
QGLContext. This is equivalent to callingglUseProgram(0).See also
- PySide2.QtOpenGL.QGLShaderProgram.removeAllShaders()¶
Removes all of the shaders that were added to this program previously. The
QGLShaderobjects for the shaders will not be deleted if they were constructed externally.QGLShaderobjects that are constructed internally byQGLShaderProgramwill be deleted.See also
- PySide2.QtOpenGL.QGLShaderProgram.removeShader(shader)¶
- Parameters:
shader –
PySide2.QtOpenGL.QGLShader
Removes
shaderfrom this shader program. The object is not deleted.The shader program must be valid in the current
QGLContext.See also
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeArray2D(name, values[, stride=0])¶
- Parameters:
name – str
values –
PySide2.QtGui.QVector2Dstride – int
This is an overloaded function.
Sets an array of 2D vertex
valueson the attribute callednamein this shader program. Thestrideindicates the number of bytes between vertices. A defaultstridevalue of zero indicates that the vertices are densely packed invalues.The array will become active when
enableAttributeArray()is called onname. Otherwise the value specified withsetAttributeValue()fornamewill be used.
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeArray2D(location, values[, stride=0])
- Parameters:
location – int
values –
PySide2.QtGui.QVector2Dstride – int
Sets an array of 2D vertex
valueson the attribute atlocationin this shader program. Thestrideindicates the number of bytes between vertices. A defaultstridevalue of zero indicates that the vertices are densely packed invalues.The array will become active when
enableAttributeArray()is called on thelocation. Otherwise the value specified withsetAttributeValue()forlocationwill be used.
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeArray3D(name, values[, stride=0])¶
- Parameters:
name – str
values –
PySide2.QtGui.QVector3Dstride – int
This is an overloaded function.
Sets an array of 3D vertex
valueson the attribute callednamein this shader program. Thestrideindicates the number of bytes between vertices. A defaultstridevalue of zero indicates that the vertices are densely packed invalues.The array will become active when
enableAttributeArray()is called onname. Otherwise the value specified withsetAttributeValue()fornamewill be used.
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeArray3D(location, values[, stride=0])
- Parameters:
location – int
values –
PySide2.QtGui.QVector3Dstride – int
Sets an array of 3D vertex
valueson the attribute atlocationin this shader program. Thestrideindicates the number of bytes between vertices. A defaultstridevalue of zero indicates that the vertices are densely packed invalues.The array will become active when
enableAttributeArray()is called on thelocation. Otherwise the value specified withsetAttributeValue()forlocationwill be used.
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeArray4D(location, values[, stride=0])¶
- Parameters:
location – int
values –
PySide2.QtGui.QVector4Dstride – int
Sets an array of 4D vertex
valueson the attribute atlocationin this shader program. Thestrideindicates the number of bytes between vertices. A defaultstridevalue of zero indicates that the vertices are densely packed invalues.The array will become active when
enableAttributeArray()is called on thelocation. Otherwise the value specified withsetAttributeValue()forlocationwill be used.
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeArray4D(name, values[, stride=0])
- Parameters:
name – str
values –
PySide2.QtGui.QVector4Dstride – int
This is an overloaded function.
Sets an array of 4D vertex
valueson the attribute callednamein this shader program. Thestrideindicates the number of bytes between vertices. A defaultstridevalue of zero indicates that the vertices are densely packed invalues.The array will become active when
enableAttributeArray()is called onname. Otherwise the value specified withsetAttributeValue()fornamewill be used.
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeBuffer(name, type, offset, tupleSize[, stride=0])¶
- Parameters:
name – str
type –
GLenumoffset – int
tupleSize – int
stride – int
This is an overloaded function.
Sets an array of vertex values on the attribute called
namein this shader program, starting at a specificoffsetin the currently bound vertex buffer. Thestrideindicates the number of bytes between vertices. A defaultstridevalue of zero indicates that the vertices are densely packed in the value array.The
typeindicates the type of elements in the vertex value array, usuallyGL_FLOAT,GL_UNSIGNED_BYTE, etc. ThetupleSizeindicates the number of components per vertex: 1, 2, 3, or 4.The array will become active when
enableAttributeArray()is called on thename. Otherwise the value specified withsetAttributeValue()fornamewill be used.See also
setAttributeArray()
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeBuffer(location, type, offset, tupleSize[, stride=0])
- Parameters:
location – int
type –
GLenumoffset – int
tupleSize – int
stride – int
Sets an array of vertex values on the attribute at
locationin this shader program, starting at a specificoffsetin the currently bound vertex buffer. Thestrideindicates the number of bytes between vertices. A defaultstridevalue of zero indicates that the vertices are densely packed in the value array.The
typeindicates the type of elements in the vertex value array, usuallyGL_FLOAT,GL_UNSIGNED_BYTE, etc. ThetupleSizeindicates the number of components per vertex: 1, 2, 3, or 4.The array will become active when
enableAttributeArray()is called on thelocation. Otherwise the value specified withsetAttributeValue()forlocationwill be used.Note
Normalization will be enabled. If this is not desired, call glVertexAttribPointer directly though
QGLFunctions.See also
setAttributeArray()
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(location, value)¶
- Parameters:
location – int
value –
PySide2.QtGui.QVector4D
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QVector3D
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QVector2D
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QColor
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(location, x, y, z, w)
- Parameters:
location – int
x –
GLfloaty –
GLfloatz –
GLfloatw –
GLfloat
Sets the attribute at
locationin the current context to the 4D vector (x,y,z,w).See also
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(location, x, y, z)
- Parameters:
location – int
x –
GLfloaty –
GLfloatz –
GLfloat
Sets the attribute at
locationin the current context to the 3D vector (x,y,z).See also
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(location, x, y)
- Parameters:
location – int
x –
GLfloaty –
GLfloat
Sets the attribute at
locationin the current context to the 2D vector (x,y).See also
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(location, value)
- Parameters:
location – int
value –
GLfloat
Sets the attribute at
locationin the current context tovalue.See also
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QVector3D
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QVector4D
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(name, value)
- Parameters:
name – str
value –
GLfloat
This is an overloaded function.
Sets the attribute called
namein the current context tovalue.See also
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(name, x, y)
- Parameters:
name – str
x –
GLfloaty –
GLfloat
This is an overloaded function.
Sets the attribute called
namein the current context to the 2D vector (x,y).See also
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(name, x, y, z)
- Parameters:
name – str
x –
GLfloaty –
GLfloatz –
GLfloat
This is an overloaded function.
Sets the attribute called
namein the current context to the 3D vector (x,y,z).See also
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QColor
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QVector2D
- PySide2.QtOpenGL.QGLShaderProgram.setAttributeValue(name, x, y, z, w)
- Parameters:
name – str
x –
GLfloaty –
GLfloatz –
GLfloatw –
GLfloat
This is an overloaded function.
Sets the attribute called
namein the current context to the 4D vector (x,y,z,w).See also
- PySide2.QtOpenGL.QGLShaderProgram.setGeometryInputType(inputType)¶
- Parameters:
inputType –
GLenum
Sets the input type from
inputType.This parameter takes effect the next time the program is linked.
See also
- PySide2.QtOpenGL.QGLShaderProgram.setGeometryOutputType(outputType)¶
- Parameters:
outputType –
GLenum
Sets the output type from the geometry shader, if active, to
outputType.This parameter takes effect the next time the program is linked.
See also
- PySide2.QtOpenGL.QGLShaderProgram.setGeometryOutputVertexCount(count)¶
- Parameters:
count – int
Sets the maximum number of vertices the current geometry shader program will produce, if active, to
count.This parameter takes effect the next time the program is linked.
See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)¶
- Parameters:
location – int
value –
GLfloat
Sets the uniform variable at
locationin the current context tovalue.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QMatrix3x2
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QMatrix2x4
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QMatrix2x3
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QMatrix2x2
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, color)
- Parameters:
location – int
color –
PySide2.QtGui.QColor
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
GLuint
Sets the uniform variable at
locationin the current context tovalue. This function should be used when setting sampler values.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
GLint
Sets the uniform variable at
locationin the current context tovalue.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, x, y, z, w)
- Parameters:
location – int
x –
GLfloaty –
GLfloatz –
GLfloatw –
GLfloat
Sets the uniform variable at
locationin the current context to the 4D vector (x,y,z,w).See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, x, y, z)
- Parameters:
location – int
x –
GLfloaty –
GLfloatz –
GLfloat
Sets the uniform variable at
locationin the current context to the 3D vector (x,y,z).See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, x, y)
- Parameters:
location – int
x –
GLfloaty –
GLfloat
Sets the uniform variable at
locationin the current context to the 2D vector (x,y).See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QMatrix3x3
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QMatrix3x4
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QMatrix4x2
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QMatrix4x3
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QMatrix4x4
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, point)
- Parameters:
location – int
point –
PySide2.QtCore.QPoint
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, point)
- Parameters:
location – int
point –
PySide2.QtCore.QPointF
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, size)
- Parameters:
location – int
size –
PySide2.QtCore.QSize
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, size)
- Parameters:
location – int
size –
PySide2.QtCore.QSizeF
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QTransform
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QVector2D
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QVector3D
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(location, value)
- Parameters:
location – int
value –
PySide2.QtGui.QVector4D
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QVector3D
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QVector4D
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
GLfloat
This is an overloaded function.
Sets the uniform variable called
namein the current context tovalue.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, x, y)
- Parameters:
name – str
x –
GLfloaty –
GLfloat
This is an overloaded function.
Sets the uniform variable called
namein the current context to the 2D vector (x,y).See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, x, y, z)
- Parameters:
name – str
x –
GLfloaty –
GLfloatz –
GLfloat
This is an overloaded function.
Sets the uniform variable called
namein the current context to the 3D vector (x,y,z).See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, x, y, z, w)
- Parameters:
name – str
x –
GLfloaty –
GLfloatz –
GLfloatw –
GLfloat
This is an overloaded function.
Sets the uniform variable called
namein the current context to the 4D vector (x,y,z,w).See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
GLint
This is an overloaded function.
Sets the uniform variable called
namein the current context tovalue.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
GLuint
This is an overloaded function.
Sets the uniform variable called
namein the current context tovalue. This function should be used when setting sampler values.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, color)
- Parameters:
name – str
color –
PySide2.QtGui.QColor
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QMatrix2x2
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QMatrix2x3
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QMatrix2x4
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QMatrix3x2
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QMatrix3x4
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QMatrix4x2
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QMatrix4x3
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QMatrix4x4
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, point)
- Parameters:
name – str
point –
PySide2.QtCore.QPoint
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, point)
- Parameters:
name – str
point –
PySide2.QtCore.QPointF
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, size)
- Parameters:
name – str
size –
PySide2.QtCore.QSize
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, size)
- Parameters:
name – str
size –
PySide2.QtCore.QSizeF
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QTransform
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QVector2D
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValue(name, value)
- Parameters:
name – str
value –
PySide2.QtGui.QMatrix3x3
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray2D(location, values)¶
- Parameters:
location – int
values –
PySide2.QtGui.QVector2D
Sets the uniform variable array at
locationin the current context to thecount2D vector elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray2D(name, values)
- Parameters:
name – str
values –
PySide2.QtGui.QVector2D
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecount2D vector elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray2x2(name, values)¶
- Parameters:
name – str
values –
PySide2.QtGui.QMatrix2x2
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecount2x2 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray2x2(location, values)
- Parameters:
location – int
values –
PySide2.QtGui.QMatrix2x2
Sets the uniform variable array at
locationin the current context to thecount2x2 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray2x3(name, values)¶
- Parameters:
name – str
values –
PySide2.QtGui.QMatrix2x3
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecount2x3 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray2x3(location, values)
- Parameters:
location – int
values –
PySide2.QtGui.QMatrix2x3
Sets the uniform variable array at
locationin the current context to thecount2x3 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray2x4(name, values)¶
- Parameters:
name – str
values –
PySide2.QtGui.QMatrix2x4
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecount2x4 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray2x4(location, values)
- Parameters:
location – int
values –
PySide2.QtGui.QMatrix2x4
Sets the uniform variable array at
locationin the current context to thecount2x4 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray3D(location, values)¶
- Parameters:
location – int
values –
PySide2.QtGui.QVector3D
Sets the uniform variable array at
locationin the current context to thecount3D vector elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray3D(name, values)
- Parameters:
name – str
values –
PySide2.QtGui.QVector3D
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecount3D vector elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray3x2(name, values)¶
- Parameters:
name – str
values –
PySide2.QtGui.QMatrix3x2
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecount3x2 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray3x2(location, values)
- Parameters:
location – int
values –
PySide2.QtGui.QMatrix3x2
Sets the uniform variable array at
locationin the current context to thecount3x2 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray3x3(name, values)¶
- Parameters:
name – str
values –
PySide2.QtGui.QMatrix3x3
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecount3x3 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray3x3(location, values)
- Parameters:
location – int
values –
PySide2.QtGui.QMatrix3x3
Sets the uniform variable array at
locationin the current context to thecount3x3 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray3x4(name, values)¶
- Parameters:
name – str
values –
PySide2.QtGui.QMatrix3x4
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecount3x4 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray3x4(location, values)
- Parameters:
location – int
values –
PySide2.QtGui.QMatrix3x4
Sets the uniform variable array at
locationin the current context to thecount3x4 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray4D(name, values)¶
- Parameters:
name – str
values –
PySide2.QtGui.QVector4D
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecount4D vector elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray4D(location, values)
- Parameters:
location – int
values –
PySide2.QtGui.QVector4D
Sets the uniform variable array at
locationin the current context to thecount4D vector elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray4x2(name, values)¶
- Parameters:
name – str
values –
PySide2.QtGui.QMatrix4x2
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecount4x2 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray4x2(location, values)
- Parameters:
location – int
values –
PySide2.QtGui.QMatrix4x2
Sets the uniform variable array at
locationin the current context to thecount4x2 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray4x3(name, values)¶
- Parameters:
name – str
values –
PySide2.QtGui.QMatrix4x3
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecount4x3 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray4x3(location, values)
- Parameters:
location – int
values –
PySide2.QtGui.QMatrix4x3
Sets the uniform variable array at
locationin the current context to thecount4x3 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray4x4(name, values)¶
- Parameters:
name – str
values –
PySide2.QtGui.QMatrix4x4
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecount4x4 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArray4x4(location, values)
- Parameters:
location – int
values –
PySide2.QtGui.QMatrix4x4
Sets the uniform variable array at
locationin the current context to thecount4x4 matrix elements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArrayInt(location, values)¶
- Parameters:
location – int
values –
GLint
Sets the uniform variable array at
locationin the current context to thecountelements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArrayInt(name, values)
- Parameters:
name – str
values –
GLint
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecountelements ofvalues.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArrayUint(location, values)¶
- Parameters:
location – int
values –
GLuint
Sets the uniform variable array at
locationin the current context to thecountelements ofvalues. This overload should be used when setting an array of sampler values.See also
- PySide2.QtOpenGL.QGLShaderProgram.setUniformValueArrayUint(name, values)
- Parameters:
name – str
values –
GLuint
This is an overloaded function.
Sets the uniform variable array called
namein the current context to thecountelements ofvalues. This overload should be used when setting an array of sampler values.See also
- PySide2.QtOpenGL.QGLShaderProgram.shaders()¶
- Return type:
Returns a list of all shaders that have been added to this shader program using
addShader().See also
- PySide2.QtOpenGL.QGLShaderProgram.uniformLocation(name)¶
- Parameters:
name –
PySide2.QtCore.QByteArray- Return type:
int
- PySide2.QtOpenGL.QGLShaderProgram.uniformLocation(name)
- Parameters:
name – str
- Return type:
int
- PySide2.QtOpenGL.QGLShaderProgram.uniformLocation(name)
- Parameters:
name – str
- Return type:
int
Returns the location of the uniform variable
namewithin this shader program’s parameter list. Returns -1 ifnameis not a valid uniform variable for this shader program.See also
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.