4.6 版新增。
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).
QGLShaderandQGLShaderProgramshelter the programmer from the details of compiling and linking vertex and fragment shaders.注意
This class has been deprecated in favor of
QOpenGLShader.另请参阅
QGLShader
(
type
[
,
parent=None
]
)
¶
QGLShader(type, context[, parent=None])
- param type
ShaderType- param parent
QObject- param context
构造新
QGLShader
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
QGLContext
.
构造新
QGLShader
object of the specified
type
and attaches it to
parent
. If shader programs are not supported, then
hasOpenGLShaderPrograms()
will return false.
This constructor is normally followed by a call to
compileSourceCode()
or
compileSourceFile()
.
The shader will be associated with
context
.
PySide2.QtOpenGL.QGLShader.
ShaderTypeBit
¶
This enum specifies the type of
QGLShader
that is being created.
|
常量 |
描述 |
|---|---|
|
QGLShader.Vertex |
Vertex shader written in the OpenGL Shading Language (GLSL). |
|
QGLShader.Fragment |
Fragment shader written in the OpenGL Shading Language (GLSL). |
|
QGLShader.Geometry |
Geometry shaders written in the OpenGL Shading Language (GLSL), based on the GL_EXT_geometry_shader4 extension. |
PySide2.QtOpenGL.QGLShader.
compileSourceCode
(
source
)
¶
source
–
QByteArray
bool
PySide2.QtOpenGL.QGLShader.
compileSourceCode
(
source
)
¶
source – unicode
bool
PySide2.QtOpenGL.QGLShader.
compileSourceCode
(
source
)
¶
source – str
bool
设置
source
code for this shader and compiles it. Returns
true
if the source was successfully compiled, false otherwise.
另请参阅
PySide2.QtOpenGL.QGLShader.
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.QtOpenGL.QGLShader.
hasOpenGLShaders
(
type
[
,
context=None
]
)
¶
type
–
ShaderType
context
–
QGLContext
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.QtOpenGL.QGLShader.
isCompiled
(
)
¶
bool
返回
true
if this shader has been compiled; false otherwise.
PySide2.QtOpenGL.QGLShader.
log
(
)
¶
unicode
Returns the errors and warnings that occurred during the last compile.
PySide2.QtOpenGL.QGLShader.
shaderId
(
)
¶
GLuint
Returns the OpenGL identifier associated with this shader.
另请参阅
PySide2.QtOpenGL.QGLShader.
shaderType
(
)
¶
ShaderType
Returns the type of this shader.
PySide2.QtOpenGL.QGLShader.
sourceCode
(
)
¶
QByteArray
Returns the source code for this shader.
另请参阅