QNativeInterface::QWGLContext Struct

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

頭: #include <QOpenGLContext>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
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 句柄。

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