QOpenGLShader#
The QOpenGLShader
class allows OpenGL shaders to be compiled. More…
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])
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
This class supports shaders written in the OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES).
QOpenGLShader
and QOpenGLShaderProgram
shelter the programmer from the details of compiling and linking vertex and fragment shaders.
See also
- class PySide6.QtOpenGL.QOpenGLShader(type[, parent=None])#
- Parameters:
type –
ShaderType
parent –
PySide6.QtCore.QObject
Constructs a new QOpenGLShader
object of the specified type
and attaches it to parent
. If shader programs are not supported, hasOpenGLShaderPrograms()
will return false.
This constructor is normally followed by a call to compileSourceCode()
or compileSourceFile()
.
The shader will be associated with the current QOpenGLContext
.
See also
- PySide6.QtOpenGL.QOpenGLShader.ShaderTypeBit#
(inherits enum.Flag
) 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).
- PySide6.QtOpenGL.QOpenGLShader.compileSourceCode(source)#
- Parameters:
source –
PySide6.QtCore.QByteArray
- Return type:
bool
This is an overloaded function.
Sets the source
code for this shader and compiles it. Returns true
if the source was successfully compiled, false otherwise.
See also
- PySide6.QtOpenGL.QOpenGLShader.compileSourceCode(source)
- Parameters:
source – str
- Return type:
bool
This is an overloaded function.
Sets the source
code for this shader and compiles it. Returns true
if the source was successfully compiled, false otherwise.
See also
- PySide6.QtOpenGL.QOpenGLShader.compileSourceCode(source)
- Parameters:
source – str
- Return type:
bool
Sets the source
code for this shader and compiles it. Returns true
if the source was successfully compiled, false otherwise.
See also
- PySide6.QtOpenGL.QOpenGLShader.compileSourceFile(fileName)#
- Parameters:
fileName – str
- Return type:
bool
Sets the source code for this shader to the contents of fileName
and compiles it. Returns true
if the file could be opened and the source compiled, false otherwise.
See also
- static PySide6.QtOpenGL.QOpenGLShader.hasOpenGLShaders(type[, context=None])#
- Parameters:
type –
ShaderType
context –
PySide6.QtGui.QOpenGLContext
- Return type:
bool
Returns true
if shader programs of type type
are supported on this system; false otherwise.
The context
is used to resolve the GLSL extensions. If context
is None
, then currentContext()
is used.
- PySide6.QtOpenGL.QOpenGLShader.isCompiled()#
- Return type:
bool
Returns true
if this shader has been compiled; false otherwise.
See also
- PySide6.QtOpenGL.QOpenGLShader.log()#
- Return type:
str
Returns the errors and warnings that occurred during the last compile.
See also
- PySide6.QtOpenGL.QOpenGLShader.shaderId()#
- Return type:
int
Returns the OpenGL identifier associated with this shader.
See also
- PySide6.QtOpenGL.QOpenGLShader.shaderType()#
- Return type:
Returns the type of this shader.
- PySide6.QtOpenGL.QOpenGLShader.sourceCode()#
- Return type:
Returns the source code for this shader.
See also