QSGTextureMaterial Class
QSGTextureMaterial 类提供了一种在场景图中渲染带纹理几何体的便捷方法。更多内容...
| 头文件: | #include <QSGTextureMaterial> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Quick) target_link_libraries(mytarget PRIVATE Qt6::Quick) |
| qmake: | QT += quick |
| 继承自: | QSGOpaqueTextureMaterial |
- 所有成员列表(包括继承的成员)
- QSGTextureMaterial 属于Qt Quick 场景图材质类。
详细说明
警告:此 实用类仅在使用Qt Quick 场景图的默认后端时才有效。
带纹理的材质将使用提供的纹理填充几何体中的每个像素。
要使用纹理材质渲染的几何体需要在属性位置 0 处具有顶点,并在属性位置 1 处具有纹理坐标。纹理坐标是一个二维浮点元组。QSGGeometry::defaultAttributes_TexturedPoint2D 返回与该材质兼容的属性集。
待渲染的纹理可通过 `setTexture()` 进行设置。纹理的渲染方式可通过 `setMipmapFiltering()`、`setFiltering()`、`setHorizontalWrapMode()` 和 `setVerticalWrapMode()` 进行指定。渲染状态会在纹理实例绑定之前对其进行设置。
带纹理的材质会遵循纹理的当前变换矩阵和透明度通道。它还会遵循场景图中累积的透明度。
纹理材质必须先设置好纹理,才能在场景图中作为材质使用。
© 2026 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.