QOpenGLShaderclass allows OpenGL shaders to be compiled. 更多 …
New in version 5.0.
def
compileSourceCode
(source)
def
compileSourceCode
(source)
def
compileSourceCode
(source)
def
compileSourceFile
(fileName)
def
isCompiled
()
def
log
()
def
shaderId
()
def
shaderType
()
def
sourceCode
()
def
hasOpenGLShaders
(type[, context=None])
This class supports shaders written in the OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES).
QOpenGLShaderandQOpenGLShaderProgramshelter the programmer from the details of compiling and linking vertex and fragment shaders.另请参阅
QOpenGLShader
(
type
[
,
parent=None
]
)
¶
- param type
ShaderType- param parent
QObject
构造新
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
.
PySide2.QtGui.QOpenGLShader.
ShaderTypeBit
¶
This enum specifies the type of
QOpenGLShader
that is being created.
|
常量 |
描述 |
|---|---|
|
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
)
¶
source
–
QByteArray
bool
PySide2.QtGui.QOpenGLShader.
compileSourceCode
(
source
)
¶
source – unicode
bool
PySide2.QtGui.QOpenGLShader.
compileSourceCode
(
source
)
¶
source – str
bool
设置
source
code for this shader and compiles it. Returns
true
if the source was successfully compiled, false otherwise.
另请参阅
PySide2.QtGui.QOpenGLShader.
compileSourceFile
(
fileName
)
¶
fileName – unicode
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.
另请参阅
PySide2.QtGui.QOpenGLShader.
hasOpenGLShaders
(
type
[
,
context=None
]
)
¶
type
–
ShaderType
context
–
QOpenGLContext
bool
返回
true
if shader programs of type
type
are supported on this system; false otherwise.
context
is used to resolve the GLSL extensions. If
context
is
None
,那么
currentContext()
被使用。
PySide2.QtGui.QOpenGLShader.
isCompiled
(
)
¶
bool
返回
true
if this shader has been compiled; false otherwise.
PySide2.QtGui.QOpenGLShader.
log
(
)
¶
unicode
Returns the errors and warnings that occurred during the last compile.
PySide2.QtGui.QOpenGLShader.
shaderId
(
)
¶
GLuint
Returns the OpenGL identifier associated with this shader.
另请参阅
PySide2.QtGui.QOpenGLShader.
shaderType
(
)
¶
ShaderType
Returns the type of this shader.
PySide2.QtGui.QOpenGLShader.
sourceCode
(
)
¶
QByteArray
Returns the source code for this shader.
另请参阅