QSGVertexColorMaterial Class

The QSGVertexColorMaterial class provides a convenient way of rendering per-vertex colored geometry in the scene graph. More...

Header: #include <QSGVertexColorMaterial>
Inherits: QSGMaterial

Public Functions

Reimplemented Public Functions

virtual int compare(const QSGMaterial *other) const override

Reimplemented Protected Functions

virtual QSGMaterialShader *createShader(QSGRendererInterface::RenderMode renderMode) const override
virtual QSGMaterialType *type() const override

Detailed Description

\inmoduleQtQuick \ingroup qtquick-scenegraph-materials

Warning: This utility class is only functional when running with the default backend of the Qt Quick scenegraph.

The vertex color material will give each vertex in a geometry a color. Pixels between vertices will be linearly interpolated. The colors can contain transparency.

The geometry to be rendered with vertex color must have the following layout. Attribute position 0 must contain vertices. Attribute position 1 must contain colors, a tuple of 4 values with RGBA layout. Both floats in the range of 0 to 1 and unsigned bytes in the range 0 to 255 are valid for the color values.

Note: The rendering pipeline expects pixels with premultiplied alpha.

QSGGeometry::defaultAttributes_ColoredPoint2D() can be used to construct an attribute set that is compatible with this material.

The vertex color material respects both current opacity and current matrix when updating it's rendering state.

Member Function Documentation

QSGVertexColorMaterial::QSGVertexColorMaterial()

Creates a new vertex color material.

[override virtual] int QSGVertexColorMaterial::compare(const QSGMaterial *other) const

Reimplements: QSGMaterial::compare(const QSGMaterial *other) const.

int QSGVertexColorMaterial::compare() const

As the vertex color material has all its state in the vertex attributes, all materials will be equal.

\internal

[override virtual protected] QSGMaterialShader *QSGVertexColorMaterial::createShader(QSGRendererInterface::RenderMode renderMode) const

Reimplements: QSGMaterial::createShader(QSGRendererInterface::RenderMode renderMode) const.

\internal

[override virtual protected] QSGMaterialType *QSGVertexColorMaterial::type() const

Reimplements: QSGMaterial::type() const.

\internal