QNativeInterface::QGLXContext Struct

GLX 上下文的本地接口。更多

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

公共函数

int nativeContext() const

静态公共成员

QOpenGLContext *fromNative(int configBasedContext, QOpenGLContext *shareContext = nullptr)
QOpenGLContext *fromNative(int visualBasedContext, void *visualInfo, QOpenGLContext *shareContext = nullptr)

详细说明

通过QOpenGLContext::nativeInterface() 访问。

成员函数文档

[static] QOpenGLContext *QGLXContext::fromNative(int configBasedContext, QOpenGLContext *shareContext = nullptr)

采用从 FBConfig 创建的 GLXContextconfigBasedContext

该上下文必须使用glXCreateNewContext 函数从帧缓冲配置创建。

创建的QOpenGLContext shareContext 的所有权将转移给调用者。

[static] QOpenGLContext *QGLXContext::fromNative(int visualBasedContext, void *visualInfo, QOpenGLContext *shareContext = nullptr)

采用通过 X 可视化创建的 GLXContext。

必须使用glXCreateContext 函数从视觉效果创建上下文。必须在visualInfo 参数中将同一视觉效果作为指向XVisualInfo 结构的指针传递。

创建的QOpenGLContext 的所有权将转移给调用者。

int QGLXContext::nativeContext() const

返回底层 GLXContext。

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