QShaderProgram Class

(Qt3DRender::QShaderProgram)

Encapsulates a Shader Program. More...

Header: #include <QShaderProgram>
qmake: QT += 3drender
Instantiated By: ShaderProgram
Inherits: Qt3DCore::QNode

Public Types

enum ShaderType { Vertex, Fragment, TessellationControl, TessellationEvaluation, Geometry, Compute }

Properties

Public Functions

QShaderProgram(Qt3DCore::QNode *parent = nullptr)
QByteArray computeShaderCode() const
QByteArray fragmentShaderCode() const
QByteArray geometryShaderCode() const
void setShaderCode(ShaderType type, const QByteArray &shaderCode)
QByteArray shaderCode(ShaderType type) const
QByteArray tessellationControlShaderCode() const
QByteArray tessellationEvaluationShaderCode() const
QByteArray vertexShaderCode() const

Public Slots

void setComputeShaderCode(const QByteArray &computeShaderCode)
void setFragmentShaderCode(const QByteArray &fragmentShaderCode)
void setGeometryShaderCode(const QByteArray &geometryShaderCode)
void setTessellationControlShaderCode(const QByteArray &tessellationControlShaderCode)
void setTessellationEvaluationShaderCode(const QByteArray &tessellationEvaluationShaderCode)
void setVertexShaderCode(const QByteArray &vertexShaderCode)

Signals

void computeShaderCodeChanged(const QByteArray &computeShaderCode)
void fragmentShaderCodeChanged(const QByteArray &fragmentShaderCode)
void geometryShaderCodeChanged(const QByteArray &geometryShaderCode)
void tessellationControlShaderCodeChanged(const QByteArray &tessellationControlShaderCode)
void tessellationEvaluationShaderCodeChanged(const QByteArray &tessellationEvaluationShaderCode)
void vertexShaderCodeChanged(const QByteArray &vertexShaderCode)

Static Public Members

QByteArray loadSource(const QUrl &sourceUrl)

Protected Functions

QShaderProgram(QShaderProgramPrivate &dd, Qt3DCore::QNode *parent = nullptr)

Detailed Description

Encapsulates a Shader Program.

Member Type Documentation

enum QShaderProgram::ShaderType

This enum identifies the type of shader used

ConstantValue
Qt3DRender::QShaderProgram::Vertex0
Qt3DRender::QShaderProgram::Fragment1
Qt3DRender::QShaderProgram::TessellationControl2
Qt3DRender::QShaderProgram::TessellationEvaluation3
Qt3DRender::QShaderProgram::Geometry4
Qt3DRender::QShaderProgram::Compute5

Property Documentation

computeShaderCode : QByteArray

Specifies the compute shader code to be used

Access functions:

QByteArray computeShaderCode() const
void setComputeShaderCode(const QByteArray &computeShaderCode)

Notifier signal:

void computeShaderCodeChanged(const QByteArray &computeShaderCode)

fragmentShaderCode : QByteArray

Specifies the fragment shader code to be used

Access functions:

QByteArray fragmentShaderCode() const
void setFragmentShaderCode(const QByteArray &fragmentShaderCode)

Notifier signal:

void fragmentShaderCodeChanged(const QByteArray &fragmentShaderCode)

geometryShaderCode : QByteArray

Specifies the geometry shader code to be used

Access functions:

QByteArray geometryShaderCode() const
void setGeometryShaderCode(const QByteArray &geometryShaderCode)

Notifier signal:

void geometryShaderCodeChanged(const QByteArray &geometryShaderCode)

tessellationControlShaderCode : QByteArray

Specifies the tessellation control shader code to be used

Access functions:

QByteArray tessellationControlShaderCode() const
void setTessellationControlShaderCode(const QByteArray &tessellationControlShaderCode)

Notifier signal:

void tessellationControlShaderCodeChanged(const QByteArray &tessellationControlShaderCode)

tessellationEvaluationShaderCode : QByteArray

Specifies the tessellation evaluation shader code to be used

Access functions:

QByteArray tessellationEvaluationShaderCode() const
void setTessellationEvaluationShaderCode(const QByteArray &tessellationEvaluationShaderCode)

Notifier signal:

void tessellationEvaluationShaderCodeChanged(const QByteArray &tessellationEvaluationShaderCode)

vertexShaderCode : QByteArray

Specifies the vertex shader code to be used

Access functions:

QByteArray vertexShaderCode() const
void setVertexShaderCode(const QByteArray &vertexShaderCode)

Notifier signal:

void vertexShaderCodeChanged(const QByteArray &vertexShaderCode)

Member Function Documentation

QShaderProgram::QShaderProgram(Qt3DCore::QNode *parent = nullptr)

Constructs a new QShaderProgram with the specified parent.

[protected] QShaderProgram::QShaderProgram(QShaderProgramPrivate &dd, Qt3DCore::QNode *parent = nullptr)

Copy constructor.

[static] QByteArray QShaderProgram::loadSource(const QUrl &sourceUrl)

Returns the shader code loaded from sourceUrl.

void QShaderProgram::setShaderCode(ShaderType type, const QByteArray &shaderCode)

Sets the type shader from raw data in shaderCode.

See also shaderCode().

QByteArray QShaderProgram::shaderCode(ShaderType type) const

Returns the type shader code.

See also setShaderCode().