QSGTextureMaterial Class

The QSGTextureMaterial class provides a convenient way of rendering textured geometry in the scene graph. More...

Header: #include <QSGTextureMaterial>
CMake: find_package(Qt6 COMPONENTS Quick REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Quick)
qmake: QT += quick
Inherits: QSGOpaqueTextureMaterial

Detailed Description

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

The textured material will fill every pixel in a geometry with the supplied texture.

The geometry to be rendered with a texture material requires vertices in attribute location 0 and texture coordinates in attribute location 1. The texture coordinate is a 2-dimensional floating-point tuple. The QSGGeometry::defaultAttributes_TexturedPoint2D returns an attribute set compatible with this material.

The texture to be rendered can be set using setTexture(). How the texture should be rendered can be specified using setMipmapFiltering(), setFiltering(), setHorizontalWrapMode() and setVerticalWrapMode(). The rendering state is set on the texture instance just before it is bound.

The textured material respects the current matrix and the alpha channel of the texture. It will also respect the accumulated opacity in the scenegraph.

A texture material must have a texture set before it is used as a material in the scene graph.

© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.