[QtOpenGL module]
该QGLShader类允许的OpenGL着色器进行编译。More…
继承QObject。
Types
class **[ShaderType](docs_index.htm)**
enum ShaderTypeBit { Vertex, Fragment, Geometry }
Methods
__init__ (self, ShaderType type, QObject parent = None)
__init__ (self, ShaderType type, QGLContext context, QObject parent = None)
bool compileSourceCode (self, QByteArray source)
bool compileSourceCode (self, QString source)
bool compileSourceFile (self, QString fileName)
bool isCompiled (self)
QString log (self)
int shaderId (self)
ShaderType shaderType (self)
QByteArray sourceCode (self)
Static Methods
bool hasOpenGLShaders (ShaderType type, QGLContext context = None)
Detailed Description
该QGLShader类允许的OpenGL着色器进行编译。
此类支持写在OpenGL着色语言( GLSL )和OpenGL的/ ES着色语言( GLSL / ES )的着色器。
QGLShader和QGLShaderProgram庇护程序员的编译和连接顶点和片段着色器的详细信息。
Type Documentation
QGLShader.ShaderTypeBit
这个枚举指定的类型QGLShader正在被创建。
Constant | Value | Description |
---|---|---|
QGLShader.Vertex |
0x0001 |
顶点着色器编写的OpenGL着色语言( GLSL ) 。 |
QGLShader.Fragment |
0x0002 |
片段着色器编写的OpenGL着色语言( GLSL ) 。 |
QGLShader.Geometry |
0x0004 |
写在OpenGL着色语言( GLSL ),几何着色器的基础上, GL_EXT_geometry_shader4扩展。 |
该ShaderType类型是一个typedef为QFlags\u003cShaderTypeBit\u003e 。它存储ShaderTypeBit值的或组合。
Method Documentation
QGLShader.__init__ (self, ShaderType type, QObject parent = None)
该parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
构造一个新的QGLShader指定的对象type并重视它parent。如果不支持着色器程序,QGLShaderProgram.hasOpenGLShaderPrograms( )将返回False 。
此构造函数通常后跟调用compileSourceCode()或compileSourceFile( ) 。
着色器将与当前相关联QGLContext。
See also compileSourceCode()和compileSourceFile( ) 。
QGLShader.__init__ (self, ShaderType type, QGLContext context, QObject parent = None)
该parent的说法,如果不是没有,原因self通过Qt的,而不是PyQt的拥有。
构造一个新的QGLShader指定的对象type并重视它parent。如果不支持着色器程序,然后QGLShaderProgram.hasOpenGLShaderPrograms( )将返回False 。
此构造函数通常后跟调用compileSourceCode()或compileSourceFile( ) 。
着色器将与相关联context。
See also compileSourceCode()和compileSourceFile( ) 。
bool QGLShader.compileSourceCode (self, QByteArray source)
设置source码本着色器和编译它。返回True如果源被成功编译,否则返回False。
See also compileSourceFile( ) 。
bool QGLShader.compileSourceCode (self, QString source)
这是一个重载函数。
设置source码本着色器和编译它。返回True如果源被成功编译,否则返回False。
See also compileSourceFile( ) 。
bool QGLShader.compileSourceFile (self, QString fileName)
设置此着色器中的内容的源代码fileName并编译它。返回True如果文件可以被打开,源代码编译,否则返回False。
See also compileSourceCode( ) 。
bool QGLShader.hasOpenGLShaders (ShaderType type, QGLContext context = None)
返回True如果类型的着色器程序type否则为False ;此系统上都支持。
该context用于解析GLSL的扩展。如果context为null,则QGLContext.currentContext( )被使用。
此功能被引入Qt的4.7 。
bool QGLShader.isCompiled (self)
返回True如果着色器已被编译,否则为False 。
See also compileSourceCode()和compileSourceFile( ) 。
QString QGLShader.log (self)
返回上次编译期间发生的错误和警告。
See also compileSourceCode()和compileSourceFile( ) 。
int QGLShader.shaderId (self)
返回与此相关的着色器OpenGL的标识符。
See also QGLShaderProgram.programId( ) 。
ShaderType QGLShader.shaderType (self)
[
返回此着色器的类型。
](docs_index.htm)
QByteArray QGLShader.sourceCode (self)
[
返回的源代码着色器。
](docs_qbytearray.html)