QShaderProgram¶

PyQt5.Qt3DRender.QShaderProgram

Inherits from QNode.

Description¶

Encapsulates a Shader Program.

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];

Enums¶

ShaderType

This enum identifies the type of shader used.

Member

Value

Description

Compute

5

Compute shader

Fragment

1

Fragment shader

Geometry

4

Geometry shader

TessellationControl

2

Tesselation control shader

TessellationEvaluation

3

Tesselation evaluation shader

Vertex

0

Vertex shader


Status

This enum identifies the status of shader used.

Member

Value

Description

Error

2

An error occurred while compiling the shader

NotReady

0

The shader hasn’t been compiled and linked yet

Ready

1

The shader was successfully compiled

Methods¶

__init__(parent: QNode = None)

TODO


computeShaderCode() → QByteArray

fragmentShaderCode() → QByteArray

geometryShaderCode() → QByteArray

@staticmethod
loadSource(QUrl) → QByteArray

Returns the shader code loaded from sourceUrl.


log() → str

TODO


sceneChangeEvent(QSceneChange)

TODO


setComputeShaderCode(Union[QByteArray, bytes, bytearray])

setFragmentShaderCode(Union[QByteArray, bytes, bytearray])

setGeometryShaderCode(Union[QByteArray, bytes, bytearray])

setShaderCode(ShaderType, Union[QByteArray, bytes, bytearray])

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

See also

shaderCode().


setTessellationControlShaderCode(Union[QByteArray, bytes, bytearray])

setTessellationEvaluationShaderCode(Union[QByteArray, bytes, bytearray])

setVertexShaderCode(Union[QByteArray, bytes, bytearray])

See also

vertexShaderCode().


shaderCode(ShaderType) → QByteArray

Returns the shader code for type.

See also

setShaderCode().


status() → Status

Returns the status of the current shader program.


tessellationControlShaderCode() → QByteArray

tessellationEvaluationShaderCode() → QByteArray

vertexShaderCode() → QByteArray

Signals¶

computeShaderCodeChanged(Union[QByteArray, bytes, bytearray])

TODO


fragmentShaderCodeChanged(Union[QByteArray, bytes, bytearray])

TODO


geometryShaderCodeChanged(Union[QByteArray, bytes, bytearray])

TODO


logChanged(str)

TODO


statusChanged(Status)

TODO


tessellationControlShaderCodeChanged(Union[QByteArray, bytes, bytearray])

TODO


tessellationEvaluationShaderCodeChanged(Union[QByteArray, bytes, bytearray])

TODO


vertexShaderCodeChanged(Union[QByteArray, bytes, bytearray])

TODO