QSGTextureMaterial Class

QSGTextureMaterial 类提供了在场景图中渲染纹理几何体的便捷方法。更多

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

详细说明

警告: 该实用程序类只有在运行Qt Quick 场景图的默认后台时才有效。

纹理材质将用提供的纹理填充几何体中的每个像素。

使用纹理材质渲染的几何体要求顶点位于属性位置 0,纹理坐标位于属性位置 1。纹理坐标是一个二维浮点元组。QSGGeometry::defaultAttributes_TexturedPoint2D 会返回一个与该材质兼容的属性集。

可以使用setTexture() 设置要渲染的纹理。可以使用setMipmapFiltering(),setFiltering(),setHorizontalWrapMode() 和setVerticalWrapMode() 指定纹理的渲染方式。渲染状态是在绑定纹理实例之前设置的。

纹理材质尊重当前矩阵和纹理的 alpha 通道。它还会尊重场景图中累积的不透明度。

纹理材质在场景图中作为材质使用之前,必须先设置纹理。

© 2025 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.