QOpenGLShader¶
The
QOpenGLShader
class allows OpenGL shaders to be compiled. More…
New in version 5.0.
Synopsis¶
Functions¶
def
compileSourceCode
(source)def
compileSourceCode
(source)def
compileSourceCode
(source)def
compileSourceFile
(fileName)def
isCompiled
()def
log
()def
shaderId
()def
shaderType
()def
sourceCode
()
Static functions¶
def
hasOpenGLShaders
(type[, context=None])
Detailed Description¶
This class supports shaders written in the OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES).
QOpenGLShader
andQOpenGLShaderProgram
shelter the programmer from the details of compiling and linking vertex and fragment shaders.See also
- class PySide2.QtGui.QOpenGLShader(type[, parent=None])¶
- param type:
- param parent:
Constructs a new
QOpenGLShader
object of the specifiedtype
and attaches it toparent
. If shader programs are not supported,hasOpenGLShaderPrograms()
will return false.This constructor is normally followed by a call to
compileSourceCode()
orcompileSourceFile()
.The shader will be associated with the current
QOpenGLContext
.See also
- PySide2.QtGui.QOpenGLShader.ShaderTypeBit¶
This enum specifies the type of
QOpenGLShader
that is being created.Constant
Description
QOpenGLShader.Vertex
Vertex shader written in the OpenGL Shading Language (GLSL).
QOpenGLShader.Fragment
Fragment shader written in the OpenGL Shading Language (GLSL).
QOpenGLShader.Geometry
Geometry shaders written in the OpenGL Shading Language (GLSL) (requires OpenGL >= 3.2 or OpenGL ES >= 3.2).
QOpenGLShader.TessellationControl
Tessellation control shaders written in the OpenGL shading language (GLSL) (requires OpenGL >= 4.0 or OpenGL ES >= 3.2).
QOpenGLShader.TessellationEvaluation
Tessellation evaluation shaders written in the OpenGL shading language (GLSL) (requires OpenGL >= 4.0 or OpenGL ES >= 3.2).
QOpenGLShader.Compute
Compute shaders written in the OpenGL shading language (GLSL) (requires OpenGL >= 4.3 or OpenGL ES >= 3.1).
- PySide2.QtGui.QOpenGLShader.compileSourceCode(source)¶
- Parameters:
source –
PySide2.QtCore.QByteArray
- Return type:
bool
- PySide2.QtGui.QOpenGLShader.compileSourceCode(source)
- Parameters:
source – str
- Return type:
bool
- PySide2.QtGui.QOpenGLShader.compileSourceCode(source)
- Parameters:
source – str
- Return type:
bool
Sets the
source
code for this shader and compiles it. Returnstrue
if the source was successfully compiled, false otherwise.See also
- PySide2.QtGui.QOpenGLShader.compileSourceFile(fileName)¶
- Parameters:
fileName – str
- Return type:
bool
Sets the source code for this shader to the contents of
fileName
and compiles it. Returnstrue
if the file could be opened and the source compiled, false otherwise.See also
- static PySide2.QtGui.QOpenGLShader.hasOpenGLShaders(type[, context=None])¶
- Parameters:
type –
ShaderType
context –
PySide2.QtGui.QOpenGLContext
- Return type:
bool
Returns
true
if shader programs of typetype
are supported on this system; false otherwise.The
context
is used to resolve the GLSL extensions. Ifcontext
isNone
, thencurrentContext()
is used.
- PySide2.QtGui.QOpenGLShader.isCompiled()¶
- Return type:
bool
Returns
true
if this shader has been compiled; false otherwise.See also
- PySide2.QtGui.QOpenGLShader.log()¶
- Return type:
str
Returns the errors and warnings that occurred during the last compile.
See also
- PySide2.QtGui.QOpenGLShader.shaderId()¶
- Return type:
GLuint
Returns the OpenGL identifier associated with this shader.
See also
- PySide2.QtGui.QOpenGLShader.shaderType()¶
- Return type:
Returns the type of this shader.
- PySide2.QtGui.QOpenGLShader.sourceCode()¶
- Return type:
Returns the source code for this shader.
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.