QSGOpenGLTexture Struct

struct QNativeInterface::QSGOpenGLTexture

Provides access to and enables adopting OpenGL texture objects. More...

Header: #include <QSGOpenGLTexture>
CMake: find_package(Qt6 REQUIRED COMPONENTS Quick)
target_link_libraries(mytarget PRIVATE Qt6::Quick)
qmake: QT += quick
Since: Qt 6.0

Public Functions

QSGOpenGLTexture(QNativeInterface::QSGOpenGLTexture &&)
QSGOpenGLTexture(const QNativeInterface::QSGOpenGLTexture &)
QSGOpenGLTexture()
QNativeInterface::QSGOpenGLTexture &operator=(QNativeInterface::QSGOpenGLTexture &&)
QNativeInterface::QSGOpenGLTexture &operator=(const QNativeInterface::QSGOpenGLTexture &)
virtual GLuint nativeTexture() const = 0

Static Public Members

QSGTexture *fromNative(GLuint textureId, QQuickWindow *window, const QSize &size, QQuickWindow::CreateTextureOptions options = {})
QSGTexture *fromNativeExternalOES(GLuint textureId, QQuickWindow *window, const QSize &size, QQuickWindow::CreateTextureOptions options = {})

Protected Functions

virtual ~QSGOpenGLTexture()
bool hasTypeInfo()

Detailed Description

Member Function Documentation

QSGOpenGLTexture::QSGOpenGLTexture(QNativeInterface::QSGOpenGLTexture &&)

Default constructs an instance of QSGOpenGLTexture.

QSGOpenGLTexture::QSGOpenGLTexture(const QNativeInterface::QSGOpenGLTexture &)

Default constructs an instance of QSGOpenGLTexture.

QSGOpenGLTexture::QSGOpenGLTexture()

Default constructs an instance of QSGOpenGLTexture.

QNativeInterface::QSGOpenGLTexture &QSGOpenGLTexture::operator=(QNativeInterface::QSGOpenGLTexture &&)

Move-assignment operator.

QNativeInterface::QSGOpenGLTexture &QSGOpenGLTexture::operator=(const QNativeInterface::QSGOpenGLTexture &)

Copy-assignment operator.

[virtual protected] QSGOpenGLTexture::~QSGOpenGLTexture()

Destroys the instance of QSGOpenGLTexture. The destructor is virtual.

[static, since 6.0] QSGTexture *QSGOpenGLTexture::fromNative(GLuint textureId, QQuickWindow *window, const QSize &size, QQuickWindow::CreateTextureOptions options = {})

Creates a new QSGTexture wrapping an existing OpenGL texture object for window.

The native object specified in textureId is wrapped, but not owned, by the resulting QSGTexture. The caller of the function is responsible for deleting the returned QSGTexture, but that will not destroy the underlying native object.

This function is currently suitable for 2D RGBA textures only.

Warning: This function will return null if the scenegraph has not yet been initialized.

Use options to customize the texture attributes. Only the TextureHasAlphaChannel and TextureHasMipmaps are taken into account here.

size specifies the size in pixels.

Note: This function must be called on the scenegraph rendering thread.

This function was introduced in Qt 6.0.

See also QQuickWindow::sceneGraphInitialized(), QSGTexture, Scene Graph - Metal Texture Import, and Scene Graph - Vulkan Texture Import.

[static, since 6.1] QSGTexture *QSGOpenGLTexture::fromNativeExternalOES(GLuint textureId, QQuickWindow *window, const QSize &size, QQuickWindow::CreateTextureOptions options = {})

Creates a new QSGTexture wrapping an existing OpenGL ES texture object for window.

The native object specified in textureId is wrapped, but not owned, by the resulting QSGTexture. The caller of the function is responsible for deleting the returned QSGTexture, but that will not destroy the underlying native object.

This function is suitable only for textures that are meant to be used with the GL_TEXTURE_EXTERNAL_OES target: usually textures to which another device (such as a camera) writes data.

Warning: This function will return null if the scenegraph has not yet been initialized.

Use options to customize the texture attributes. Only the TextureHasAlphaChannel and TextureHasMipmaps are taken into account here.

size specifies the size in pixels.

Note: This function must be called on the scenegraph rendering thread.

This function was introduced in Qt 6.1.

See also fromNative().

[pure virtual] GLuint QSGOpenGLTexture::nativeTexture() const

Returns the OpenGL texture ID.

Related Non-Members

template <typename> bool hasTypeInfo()

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