内容表

上一话题

QOpenGLPixelTransferOptions

下一话题

QOpenGLShaderProgram

QOpenGLShader

QOpenGLShader class allows OpenGL shaders to be compiled. 更多

Inheritance diagram of PySide2.QtGui.QOpenGLShader

New in version 5.0.

概要

静态函数

详细描述

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.

class 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.

static PySide2.QtGui.QOpenGLShader. hasOpenGLShaders ( type [ , context=None ] )
参数
返回类型

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.

另请参阅

programId()

PySide2.QtGui.QOpenGLShader. shaderType ( )
返回类型

ShaderType

Returns the type of this shader.

PySide2.QtGui.QOpenGLShader. sourceCode ( )
返回类型

QByteArray

Returns the source code for this shader.