QWGLContext Struct

struct QNativeInterface ::QWGLContext

Windows WGL 上下文的本机接口。 更多...

头: #include < QOpenGLContext >
CMake: find_package(Qt6 COMPONENTS Gui REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Since: Qt 6.0

公共函数

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)

Adopts an WGL context 句柄。

window is needed because the its pixel format will be queried. When the adoption is successful, QOpenGLContext::format () 会返回 QSurfaceFormat 描述此像素格式。

注意: 窗口的指定通过 window 必须将其像素格式设为兼容上下文格式。若未在属于窗口的任何设备上下文中调用 SetPixelFormat(),采纳上下文会失败。

Ownership of the created QOpenGLContext shareContext is transferred to the caller.

[pure virtual] HGLRC QWGLContext:: nativeContext () const

Returns the underlying context handle.

[static] HMODULE QWGLContext:: openGLModuleHandle ()

Returns the handle for the OpenGL implementation that is currently in use.

注意: 此函数要求 QGuiApplication instance is already created.