QNativeInterface::QSGOpenGLTexture Struct
提供对 OpenGL 纹理对象的访问并支持其采用。更多内容...
| 头文件: | #include <QSGTexture> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Quick) target_link_libraries(mytarget PRIVATE Qt6::Quick) |
| qmake: | QT += quick |
| 自: | Qt 6.0 |
- 所有成员列表(包括继承的成员)
- QSGOpenGLTexture 属于“本机接口”部分。
公共函数
| QSGOpenGLTexture() | |
| QSGOpenGLTexture(const QNativeInterface::QSGOpenGLTexture &) | |
| QSGOpenGLTexture(QNativeInterface::QSGOpenGLTexture &&) | |
| virtual GLuint | nativeTexture() const = 0 |
| QNativeInterface::QSGOpenGLTexture & | operator=(QNativeInterface::QSGOpenGLTexture &&) |
| QNativeInterface::QSGOpenGLTexture & | operator=(const QNativeInterface::QSGOpenGLTexture &) |
静态公共成员
(since 6.0) QSGTexture * | fromNative(GLuint textureId, QQuickWindow *window, const QSize &size, QQuickWindow::CreateTextureOptions options = {}) |
(since 6.1) QSGTexture * | fromNativeExternalOES(GLuint textureId, QQuickWindow *window, const QSize &size, QQuickWindow::CreateTextureOptions options = {}) |
成员函数文档
[constexpr noexcept default] QSGOpenGLTexture::QSGOpenGLTexture()
默认——构造一个QSGOpenGLTexture 的实例。
[delete] QSGOpenGLTexture::QSGOpenGLTexture(const QNativeInterface::QSGOpenGLTexture &)
复制并构造一个QSGOpenGLTexture 的实例。该函数已被删除。
[delete] QSGOpenGLTexture::QSGOpenGLTexture(QNativeInterface::QSGOpenGLTexture &&)
通过移动构造一个QSGOpenGLTexture 的实例。该函数已被删除。
[static, since 6.0] QSGTexture *QSGOpenGLTexture::fromNative(GLuint textureId, QQuickWindow *window, const QSize &size, QQuickWindow::CreateTextureOptions options = {})
创建一个新的QSGTexture ,该对象封装了window 中指定的现有OpenGL纹理对象。
textureId 中指定的原生对象会被生成的QSGTexture 包装,但不会由其拥有。该函数的调用者负责删除返回的QSGTexture ,但这不会销毁底层的原生对象。
该函数目前仅适用于 2D RGBA 纹理。
警告: 如果场景图尚未初始化,此 函数将返回 null。
使用 `options ` 自定义纹理属性。此处仅考虑 `TextureHasAlphaChannel` 和 `TextureHasMipmaps`。
size 指定以像素为单位的大小。
注意:此 函数必须在场景图渲染线程上调用。
此函数在 Qt 6.0 中引入。
另请参阅 QQuickWindow::sceneGraphInitialized()、QSGTexture 、场景图 - Metal 纹理导入以及场景图 - Vulkan 纹理导入。
[static, since 6.1] QSGTexture *QSGOpenGLTexture::fromNativeExternalOES(GLuint textureId, QQuickWindow *window, const QSize &size, QQuickWindow::CreateTextureOptions options = {})
创建一个新的QSGTexture ,该对象封装了window 中指定的现有OpenGL ES纹理对象。
textureId 中指定的本机对象会被生成的QSGTexture 所封装,但并非由其拥有。该函数的调用者负责删除返回的QSGTexture ,但这不会销毁底层的本机对象。
此函数仅适用于 intended to be used with theGL_TEXTURE_EXTERNAL_OES 目标的纹理:通常是另一设备(如摄像机)向其写入数据的纹理。
警告: 如果场景图尚未初始化,此 函数将返回 null。
使用options 自定义纹理属性。此处仅考虑 TextureHasAlphaChannel 和 TextureHasMipmaps。
size 指定以像素为单位的尺寸。
注意: 必须在场景图的渲染线程上调用此 函数。
此函数在 Qt 6.1 中引入。
另请参阅 fromNative()。
[pure virtual] GLuint QSGOpenGLTexture::nativeTexture() const
返回 OpenGL 纹理 ID。
[delete] QNativeInterface::QSGOpenGLTexture &QSGOpenGLTexture::operator=(QNativeInterface::QSGOpenGLTexture &&)
将other 按移动赋值方式赋值给此QSGOpenGLTexture 实例。该函数已被删除。
[delete] QNativeInterface::QSGOpenGLTexture &QSGOpenGLTexture::operator=(const QNativeInterface::QSGOpenGLTexture &)
将other 复制并赋值给此QSGOpenGLTexture 实例。该函数已被删除。
© 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.