PySide6.QtOpenGL.QOpenGLShader¶
- class QOpenGLShader¶
- The - QOpenGLShaderclass allows OpenGL shaders to be compiled.- Details- This class supports shaders written in the OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES). - QOpenGLShaderand- QOpenGLShaderProgramshelter the programmer from the details of compiling and linking vertex and fragment shaders.- All data consumed by - QOpenGLShaderis expected to be trusted content. Shader source code is passed, possibly after minimal modifications, on to the underlying OpenGL implementation’s compiler, which is a black box from Qt’s perspective.- Warning - Application developers are advised to carefully consider the potential implications before passing in user-provided content to functions such as - compileSourceFile().- See also - Synopsis¶- Methods¶- def - __init__()
- def - isCompiled()
- def - log()
- def - shaderId()
- def - shaderType()
- def - sourceCode()
 - Static functions¶- 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 - class ShaderTypeBit¶
- (inherits - enum.Flag) This enum specifies the type of- QOpenGLShaderthat is being created.- Constant - Description - QOpenGLShader.ShaderTypeBit.Vertex - Vertex shader written in the OpenGL Shading Language (GLSL). - QOpenGLShader.ShaderTypeBit.Fragment - Fragment shader written in the OpenGL Shading Language (GLSL). - QOpenGLShader.ShaderTypeBit.Geometry - Geometry shaders written in the OpenGL Shading Language (GLSL) (requires OpenGL >= 3.2 or OpenGL ES >= 3.2). - QOpenGLShader.ShaderTypeBit.TessellationControl - Tessellation control shaders written in the OpenGL shading language (GLSL) (requires OpenGL >= 4.0 or OpenGL ES >= 3.2). - QOpenGLShader.ShaderTypeBit.TessellationEvaluation - Tessellation evaluation shaders written in the OpenGL shading language (GLSL) (requires OpenGL >= 4.0 or OpenGL ES >= 3.2). - QOpenGLShader.ShaderTypeBit.Compute - Compute shaders written in the OpenGL shading language (GLSL) (requires OpenGL >= 4.3 or OpenGL ES >= 3.1). 
 - __init__(type[, parent=None])¶
- Parameters:
- type – Combination of - ShaderTypeBit
- parent – - QObject
 
 
 - Constructs a new - QOpenGLShaderobject of the specified- typeand 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 - compileSourceCode(source)¶
- Parameters:
- source – - QByteArray
- Return type:
- bool 
 
 - Sets the - sourcecode for this shader and compiles it. Returns- trueif the source was successfully compiled, false otherwise.- See also - compileSourceCode(source)
- Parameters:
- source – str 
- Return type:
- bool 
 
 - Sets the - sourcecode for this shader and compiles it. Returns- trueif the source was successfully compiled, false otherwise.- See also - compileSourceCode(source)
- Parameters:
- source – str 
- Return type:
- bool 
 
 - Sets the - sourcecode for this shader and compiles it. Returns- trueif the source was successfully compiled, false otherwise.- See also - compileSourceFile(fileName)¶
- Parameters:
- fileName – str 
- Return type:
- bool 
 
 - Sets the source code for this shader to the contents of - fileNameand compiles it. Returns- trueif the file could be opened and the source compiled, false otherwise.- See also - static hasOpenGLShaders(type[, context=None])¶
- Parameters:
- type – Combination of - ShaderTypeBit
- context – - QOpenGLContext
 
- Return type:
- bool 
 
 - Returns - trueif shader programs of type- typeare supported on this system; false otherwise.- The - contextis used to resolve the GLSL extensions. If- contextis- None, then QOpenGLContext::currentContext() is used.- isCompiled()¶
- Return type:
- bool 
 
 - Returns - trueif this shader has been compiled; false otherwise.- See also - log()¶
- Return type:
- str 
 
 - Returns the errors and warnings that occurred during the last compile. - See also - shaderId()¶
- Return type:
- int 
 
 - Returns the OpenGL identifier associated with this shader. - See also - shaderType()¶
- Return type:
- Combination of - ShaderTypeBit
 
 - Returns the type of this shader. - sourceCode()¶
- Return type:
 
 - Returns the source code for this shader. - See also