Qt3DRender.QShaderProgram

Encapsulates a Shader Program. More

Inheritance diagram of PySide2.Qt3DRender.Qt3DRender.QShaderProgram

Synopsis

Functions

Slots

Signals

Static functions

Detailed Description

A shader program consists of several different shaders, such as vertex and fragment shaders.

Qt3D will automatically populate a set of default uniforms if they are encountered during the shader instrospection phase.

+——————————————–+——————————+-+——————————————————————-+++ |Default Uniform |Associated Qt3D Parameter name |GLSL declaration | +——————————————–+——————————+-+——————————————————————-+++ |ModelMatrix |modelMatrix |uniform mat4 modelMatrix; | +——————————————–+——————————+-+——————————————————————-+++ |ViewMatrix |viewMatrix |uniform mat4 viewMatrix; | +——————————————–+——————————+-+——————————————————————-+++ |ProjectionMatrix |projectionMatrix |uniform mat4 projectionMatrix; | +——————————————–+——————————+-+——————————————————————-+++ |ModelViewMatrix |modelView |uniform mat4 modelView; | +——————————————–+——————————+-+——————————————————————-+++ |ViewProjectionMatrix |viewProjectionMatrix |uniform mat4 viewProjectionMatrix; | +——————————————–+——————————+-+——————————————————————-+++ |ModelViewProjectionMatrix |modelViewProjection mvp |uniform mat4 modelViewProjection; uniform mat4 mvp; | +——————————————–+——————————+-+——————————————————————-+++ |InverseModelMatrix |inverseModelMatrix |uniform mat4 inverseModelMatrix; | +——————————————–+——————————+-+——————————————————————-+++ |InverseViewMatrix |inverseViewMatrix |uniform mat4 inverseViewMatrix; | +——————————————–+——————————+-+——————————————————————-+++ |InverseProjectionMatrix |inverseProjectionMatrix |uniform mat4 inverseProjectionMatrix; | +——————————————–+——————————+-+——————————————————————-+++ |InverseModelViewMatrix |inverseModelView |uniform mat4 inverseModelView; | +——————————————–+——————————+-+——————————————————————-+++ |InverseViewProjectionMatrix |inverseViewProjectionMatrix |uniform mat4 inverseViewProjectionMatrix; | +——————————————–+——————————+-+——————————————————————-+++ |InverseModelViewProjectionMatrix |inverseModelViewProjection |uniform mat4 inverseModelViewProjection; | +——————————————–+——————————+-+——————————————————————-+++ |ModelNormalMatrix |modelNormalMatrix |uniform mat3 modelNormalMatrix; | +——————————————–+——————————+-+——————————————————————-+++ |ModelViewNormalMatrix |modelViewNormal |uniform mat3 modelViewNormal; | +——————————————–+——————————+-+——————————————————————-+++ |ViewportMatrix |viewportMatrix |uniform mat4 viewportMatrix; | +——————————————–+——————————+-+——————————————————————-+++ |InverseViewportMatrix |inverseViewportMatrix |uniform mat4 inverseViewportMatrix; | +——————————————–+——————————+-+——————————————————————-+++ |AspectRatio (surface width / surface height)|aspectRatio |uniform float aspectRatio; | +——————————————–+——————————+-+——————————————————————-+++ |Exposure |exposure |uniform float exposure; | +——————————————–+——————————+-+——————————————————————-+++ |Gamma |gamma |uniform float gamma; | +——————————————–+——————————+-+——————————————————————-+++ |Time (in nano seconds) |time |uniform float time; | +——————————————–+——————————+-+——————————————————————-+++ |EyePosition |eyePosition |uniform vec3 eyePosition; | +——————————————–+——————————+-+——————————————————————-+++ |SkinningPalette |skinningPalette[0] |const int maxJoints = 100; uniform mat4 skinningPalette[maxJoints]; | +——————————————–+——————————+-+——————————————————————-+++

class PySide2.Qt3DRender.Qt3DRender.QShaderProgram([parent=None])
Parameters

parentQNode

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.ShaderType

This enum identifies the type of shader used.

Constant

Description

Qt3DRender.QShaderProgram.Vertex

Vertex shader

Qt3DRender.QShaderProgram.Fragment

Fragment shader

Qt3DRender.QShaderProgram.TessellationControl

Tesselation control shader

Qt3DRender.QShaderProgram.TessellationEvaluation

Tesselation evaluation shader

Qt3DRender.QShaderProgram.Geometry

Geometry shader

Qt3DRender.QShaderProgram.Compute

Compute shader

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.Status

This enum identifies the status of shader used.

Constant

Description

Qt3DRender.QShaderProgram.NotReady

The shader hasn’t been compiled and linked yet

Qt3DRender.QShaderProgram.Ready

The shader was successfully compiled

Qt3DRender.QShaderProgram.Error

An error occurred while compiling the shader

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.computeShaderCode()
Return type

QByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.computeShaderCodeChanged(computeShaderCode)
Parameters

computeShaderCodeQByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.fragmentShaderCode()
Return type

QByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.fragmentShaderCodeChanged(fragmentShaderCode)
Parameters

fragmentShaderCodeQByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.geometryShaderCode()
Return type

QByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.geometryShaderCodeChanged(geometryShaderCode)
Parameters

geometryShaderCodeQByteArray

static PySide2.Qt3DRender.Qt3DRender.QShaderProgram.loadSource(sourceUrl)
Parameters

sourceUrlQUrl

Return type

QByteArray

Returns the shader code loaded from sourceUrl .

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.log()
Return type

unicode

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.logChanged(log)
Parameters

log – unicode

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.setComputeShaderCode(computeShaderCode)
Parameters

computeShaderCodeQByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.setFragmentShaderCode(fragmentShaderCode)
Parameters

fragmentShaderCodeQByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.setGeometryShaderCode(geometryShaderCode)
Parameters

geometryShaderCodeQByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.setShaderCode(type, shaderCode)
Parameters

Sets the shader code for type of shader to the shaderCode .

See also

shaderCode()

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.setTessellationControlShaderCode(tessellationControlShaderCode)
Parameters

tessellationControlShaderCodeQByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.setTessellationEvaluationShaderCode(tessellationEvaluationShaderCode)
Parameters

tessellationEvaluationShaderCodeQByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.setVertexShaderCode(vertexShaderCode)
Parameters

vertexShaderCodeQByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.shaderCode(type)
Parameters

typeShaderType

Return type

QByteArray

Returns the shader code for type .

See also

setShaderCode()

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.status()
Return type

Status

Returns the status of the current shader program.

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.statusChanged(status)
Parameters

statusStatus

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.tessellationControlShaderCode()
Return type

QByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.tessellationControlShaderCodeChanged(tessellationControlShaderCode)
Parameters

tessellationControlShaderCodeQByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.tessellationEvaluationShaderCode()
Return type

QByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.tessellationEvaluationShaderCodeChanged(tessellationEvaluationShaderCode)
Parameters

tessellationEvaluationShaderCodeQByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.vertexShaderCode()
Return type

QByteArray

PySide2.Qt3DRender.Qt3DRender.QShaderProgram.vertexShaderCodeChanged(vertexShaderCode)
Parameters

vertexShaderCodeQByteArray