本页内容

QQuickOpenGLUtils Namespace

QQuickOpenGLUtils 命名空间包含用于与 OpenGL 后端配合使用的Qt Quick 的辅助函数。更多内容...

头文件: #include <QQuickOpenGLUtils>
CMake: find_package(Qt6 REQUIRED COMPONENTS Quick)
target_link_libraries(mytarget PRIVATE Qt6::Quick)
qmake: QT += quick
自: Qt 6.0

函数

(since 6.0) void resetOpenGLState()

详细说明

函数文档

[since 6.0] void QQuickOpenGLUtils::resetOpenGLState()

调用此函数可将当前 OpenGL 上下文重置为默认状态。

场景图使用 OpenGL 上下文,既依赖其状态,也会覆盖其状态。当将原始 OpenGL 命令与场景图渲染混合使用时,此函数提供了一种便捷的方式,可将 OpenGL 上下文状态重置为默认值。

此函数不会触及固定功能管道中的状态。

警告:此 函数仅会重置与 OpenGL 场景图内部可能发生更改相关的 OpenGL 上下文。 它不会重置任何外部更改的内容,例如在应用程序代码中执行的直接 OpenGL 调用(如果这些调用未在内部使用,例如各种 OpenGL 3.x 或 4.x 特定的状态)。

该函数在 Qt 6.0 中引入。

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