QTechnique Class▲
-
Header: QTechnique
-
Since: Qt 5.7
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
-
qmake: QT += 3drender
-
Inherited By:
-
Instantiated By: qml-qt3d-render-technique.xml
-
Inherits: Qt3DCore::QNode
Detailed Description▲
A Qt3DRender::QTechnique specifies a set of Qt3DRender::QRenderPass objects, Qt3DRender::QFilterKey objects, Qt3DRender::QParameter objects and a Qt3DRender::QGraphicsApiFilter, which together define a rendering technique the given graphics API can render. The filter keys are used by Qt3DRender::QTechniqueFilter to select specific techniques at specific parts of the FrameGraph. A QParameter defined on a QTechnique overrides parameter (of the same name) defined in QRenderPass, but are overridden by parameter in QRenderPassFilter, QTechniqueFilter, QMaterial and QEffect.
When creating an QEffect that targets several versions of a graphics API, it is useful to create several QTechnique nodes each with a graphicsApiFilter set to match one of the targeted GL versions. At runtime, the Qt3D renderer will select the most appropriate QTechnique based on which graphics API versions are supported and (if specified) the QFilterKey nodes that satisfy a given QTechniqueFilter in the FrameGraph.
When using OpenGL as the graphics API for rendering, Qt3D relies on the QSurfaceFormat returned by QSurfaceFormat::defaultFormat() at runtime to decide what is the most appropriate GL version available. If you need to customize the QSurfaceFormat, do not forget to apply it with QSurfaceFormat::setDefaultFormat(). Setting the QSurfaceFormat on the view will likely have no effect on Qt3D related rendering.
QTechnique node can not be disabled.
QTechnique *
gl3Technique =
new
QTechnique();
// Create the render passes
QRenderPass *
firstPass =
new
QRenderPass();
QRenderPass *
secondPass =
new
QRenderPass();
// Add the passes to the technique
gl3Technique-&
gt;addRenderPass(firstPass);
gl3Technique-&
gt;addRenderPass(secondPass);
// Set the targeted GL version for the technique
gl3Technique-&
gt;graphicsApiFilter()-&
gt;setApi(QGraphicsApiFilter::
OpenGL);
gl3Technique-&
gt;graphicsApiFilter()-&
gt;setMajorVersion(3
);
gl3Technique-&
gt;graphicsApiFilter()-&
gt;setMinorVersion(1
);
gl3Technique-&
gt;graphicsApiFilter()-&
gt;setProfile(QGraphicsApiFilter::
CoreProfile);
// Create a FilterKey
QFilterKey *
filterKey =
new
QFilterKey();
filterKey-&
gt;setName(QStringLiteral("name"
));
fitlerKey-&
gt;setValue(QStringLiteral("zFillPass"
));
// Add the FilterKey to the Technique
gl3Technique-&
gt;addFilterKey(filterKey);
// Create a QParameter
QParameter *
colorParameter =
new
QParameter(QStringLiteral("color"
), QColor::
fromRgbF(0.0
f, 0.0
f, 1.0
f, 1.0
f));
// Add parameter to technique
gl3Technique-&
gt;addParameter(colorParameter);
See Also▲
See also QEffect, QRenderPass, QTechniqueFilter
Property Documentation▲
[read-only] graphicsApiFilter : Qt3DRender::QGraphicsApiFilter* const▲
Specifies the graphics API filter being used
Access functions:
-
*graphicsApiFilter()
-
const *graphicsApiFilter() const
Member Function Documentation▲
void QTechnique::addFilterKey(Qt3DRender::QFilterKey *filterKey)▲
Add filterKey to the Qt3DRender::QTechnique local filter keys.
void QTechnique::addParameter(Qt3DRender::QParameter *parameter)▲
Add parameter to the technique's parameters.
void QTechnique::addRenderPass(Qt3DRender::QRenderPass *pass)▲
Appends a pass to the technique.
QList<Qt3DRender::QFilterKey *> QTechnique::filterKeys() const▲
Returns the list of Qt3DCore::QFilterKey key objects making up the filter keys of the Qt3DRender::QTechnique.
QList<Qt3DRender::QParameter *> QTechnique::parameters() const▲
Returns a vector of the techniques current parameters
void QTechnique::removeFilterKey(Qt3DRender::QFilterKey *filterKey)▲
Removes filterKey from the Qt3DRender::QTechnique local filter keys.
void QTechnique::removeParameter(Qt3DRender::QParameter *parameter)▲
Remove parameter from the technique's parameters.
void QTechnique::removeRenderPass(Qt3DRender::QRenderPass *pass)▲
Removes a pass from the technique.
QList<Qt3DRender::QRenderPass *> QTechnique::renderPasses() const▲
Returns the list of render passes contained in the technique.