QNativeInterface::QWGLContext Struct
Windows 上 WGL 上下文的本地接口。更多
头文件: | #include <QOpenGLContext> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
自 | Qt 6.0 |
- 所有成员的列表,包括继承成员
- QWGLContext 是本地接口的一部分。
公共函数
virtual HGLRC | nativeContext() const = 0 |
静态公共成员
QOpenGLContext * | fromNative(HGLRC context, HWND window, QOpenGLContext *shareContext = nullptr) |
HMODULE | openGLModuleHandle() |
详细说明
通过QOpenGLContext::nativeInterface() 访问。
成员函数文档
[static]
QOpenGLContext *QWGLContext::fromNative(HGLRC context, HWND window, QOpenGLContext *shareContext = nullptr)
采用 WGLcontext 句柄。
之所以需要window ,是因为将对其像素格式进行查询。采用成功后,QOpenGLContext::format() 将返回一个描述该像素格式的QSurfaceFormat 。
注意: window 指定的窗口必须将其像素格式设置为与上下文格式兼容的格式。如果未在属于窗口的任何设备上下文中调用 SetPixelFormat(),则上下文的采用将失败。
创建的QOpenGLContext shareContext 的所有权将转移给调用者。
[pure virtual]
HGLRC QWGLContext::nativeContext() const
返回底层上下文句柄。
[static]
HMODULE QWGLContext::openGLModuleHandle()
返回当前使用的 OpenGL 实现的句柄。
注意: 该函数要求QGuiApplication 实例已经创建。
© 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.