QQuickRenderTarget Class

The QQuickRenderTarget class provides an opaque container for native graphics resources specifying a render target, and associated metadata. More...

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

Public Functions

Static Public Members

QQuickRenderTarget fromD3D11Texture(void *texture, const QSize &pixelSize, int sampleCount = 1)
QQuickRenderTarget fromMetalTexture(MTLTexture *texture, const QSize &pixelSize, int sampleCount = 1)
QQuickRenderTarget fromOpenGLRenderBuffer(uint renderbufferId, const QSize &pixelSize, int sampleCount = 1)
QQuickRenderTarget fromOpenGLTexture(uint textureId, const QSize &pixelSize, int sampleCount = 1)
QQuickRenderTarget fromVulkanImage(VkImage image, VkImageLayout layout, const QSize &pixelSize, int sampleCount = 1)
bool operator!=(const QQuickRenderTarget &a, const QQuickRenderTarget &b)
bool operator==(const QQuickRenderTarget &a, const QQuickRenderTarget &b)

Detailed Description

See also QQuickWindow::setRenderTarget() and QQuickGraphicsDevice.

Member Function Documentation

QQuickRenderTarget::QQuickRenderTarget()

Constructs a default QQuickRenderTarget that does not reference any native objects.

QQuickRenderTarget::~QQuickRenderTarget()

Destructor.

[static] QQuickRenderTarget QQuickRenderTarget::fromD3D11Texture(void *texture, const QSize &pixelSize, int sampleCount = 1)

Returns a new QQuickRenderTarget referencing an D3D11 texture object specified by texture.

pixelSize specifies the size of the image, in pixels. Currently only 2D textures are supported.

sampleCount specific the number of samples. 0 or 1 means no multisampling, while a value like 4 or 8 states that the native object is a multisample texture.

Note: the resulting QQuickRenderTarget does not own any native resources, it merely contains references and the associated metadata of the size and sample count. It is the caller's responsibility to ensure that the native resource exists as long as necessary.

See also QQuickWindow::setRenderTarget() and QQuickRenderControl.

[static] QQuickRenderTarget QQuickRenderTarget::fromMetalTexture(MTLTexture *texture, const QSize &pixelSize, int sampleCount = 1)

Returns a new QQuickRenderTarget referencing an Metal texture object specified by texture.

pixelSize specifies the size of the image, in pixels. Currently only 2D textures are supported.

sampleCount specific the number of samples. 0 or 1 means no multisampling, while a value like 4 or 8 states that the native object is a multisample texture.

Note: the resulting QQuickRenderTarget does not own any native resources, it merely contains references and the associated metadata of the size and sample count. It is the caller's responsibility to ensure that the native resource exists as long as necessary.

See also QQuickWindow::setRenderTarget() and QQuickRenderControl.

[static, since 6.2] QQuickRenderTarget QQuickRenderTarget::fromOpenGLRenderBuffer(uint renderbufferId, const QSize &pixelSize, int sampleCount = 1)

Returns a new QQuickRenderTarget referencing an OpenGL renderbuffer object specified by renderbufferId.

The renderbuffer will be used as the color attachment for the internal framebuffer object. This function is provided to allow targeting renderbuffers that are created by the application with some external buffer underneath, such as an EGLImageKHR. Once the application has called glEGLImageTargetRenderbufferStorageOES, the renderbuffer can be passed to this function.

pixelSize specifies the size of the image, in pixels.

sampleCount specific the number of samples. 0 or 1 means no multisampling, while a value like 4 or 8 states that the native object is a multisample renderbuffer.

Note: the resulting QQuickRenderTarget does not own any native resources, it merely contains references and the associated metadata of the size and sample count. It is the caller's responsibility to ensure that the native resource exists as long as necessary.

This function was introduced in Qt 6.2.

See also QQuickWindow::setRenderTarget() and QQuickRenderControl.

[static] QQuickRenderTarget QQuickRenderTarget::fromOpenGLTexture(uint textureId, const QSize &pixelSize, int sampleCount = 1)

Returns a new QQuickRenderTarget referencing an OpenGL texture object specified by textureId.

pixelSize specifies the size of the image, in pixels. Currently only 2D textures are supported.

sampleCount specific the number of samples. 0 or 1 means no multisampling, while a value like 4 or 8 states that the native object is a multisample texture.

Note: the resulting QQuickRenderTarget does not own any native resources, it merely contains references and the associated metadata of the size and sample count. It is the caller's responsibility to ensure that the native resource exists as long as necessary.

See also QQuickWindow::setRenderTarget() and QQuickRenderControl.

[static] QQuickRenderTarget QQuickRenderTarget::fromVulkanImage(VkImage image, VkImageLayout layout, const QSize &pixelSize, int sampleCount = 1)

Returns a new QQuickRenderTarget referencing an Vulkan image object specified by image. The current layout of the image must be provided as well.

pixelSize specifies the size of the image, in pixels. Currently only 2D textures are supported.

sampleCount specific the number of samples. 0 or 1 means no multisampling, while a value like 4 or 8 states that the native object is a multisample texture.

Note: the resulting QQuickRenderTarget does not own any native resources, it merely contains references and the associated metadata of the size and sample count. It is the caller's responsibility to ensure that the native resource exists as long as necessary.

See also QQuickWindow::setRenderTarget() and QQuickRenderControl.

bool QQuickRenderTarget::isNull() const

Returns true if this QQuickRenderTarget is default constructed, referencing no native objects.

Related Non-Members

bool operator!=(const QQuickRenderTarget &a, const QQuickRenderTarget &b)

Returns true if a and b refer to a different set of native objects, or the associated data (size, sample count) does not match.

bool operator==(const QQuickRenderTarget &a, const QQuickRenderTarget &b)

Returns true if a and b refer to the same set of native objects and have matching associated data (size, sample count).