- class QQuickRenderTarget#
The
QQuickRenderTarget
class provides an opaque container for native graphics resources specifying a render target, and associated metadata. More…Synopsis#
Methods#
def
__init__()
def
isNull()
def
__ne__()
def
__eq__()
Static functions#
Note
This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE
Detailed Description#
See also
- __init__()#
Constructs a default
QQuickRenderTarget
that does not reference any native objects.- __init__(other)
- Parameters:
other –
QQuickRenderTarget
- devicePixelRatio()#
- Return type:
float
Returns the device pixel ratio for the render target. This is the ratio between device pixels and device independent pixels.
The default device pixel ratio is 1.0.
See also
- static fromOpenGLRenderBuffer(renderbufferId, pixelSize[, sampleCount=1])#
- Parameters:
renderbufferId – int
pixelSize –
QSize
sampleCount – int
- Return type:
Returns a new
QQuickRenderTarget
referencing an OpenGL renderbuffer object specified byrenderbufferId
.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.See also
- static fromOpenGLTexture(textureId, pixelSize[, sampleCount=1])#
- Parameters:
textureId – int
pixelSize –
QSize
sampleCount – int
- Return type:
This is an overloaded function.
Returns a new
QQuickRenderTarget
referencing an OpenGL texture object specified bytextureId
. The texture is assumed to have a format of GL_RGBA (GL_RGBA8).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.The texture is used as the first color attachment of the render target used by the Qt Quick scenegraph. A depth-stencil buffer, if applicable, is created and used automatically.
The OpenGL object name
textureId
must be a valid name in the rendering context used by the Qt Quick scenegraph.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
- static fromOpenGLTexture(textureId, format, pixelSize[, sampleCount=1])
- Parameters:
textureId – int
format – int
pixelSize –
QSize
sampleCount – int
- Return type:
Returns a new
QQuickRenderTarget
referencing an OpenGL texture object specified bytextureId
.format
specifies the native internal format of the texture. Only texture formats that are supported by Qt’s rendering infrastructure should be used.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.The texture is used as the first color attachment of the render target used by the Qt Quick scenegraph. A depth-stencil buffer, if applicable, is created and used automatically.
The OpenGL object name
textureId
must be a valid name in the rendering context used by the Qt Quick scenegraph.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
- static fromPaintDevice(device)#
- Parameters:
device –
QPaintDevice
- Return type:
Returns a new
QQuickRenderTarget
referencing a paint device object specified bydevice
.This option of redirecting rendering to a QPaintDevice is available only when running with the
software
backend of Qt Quick.Note
The
QQuickRenderTarget
does not take ownship ofdevice
, it is the caller’s responsibility to ensure the object exists as long as necessary.See also
- static fromRhiRenderTarget(renderTarget)#
- Parameters:
renderTarget –
QRhiRenderTarget
- Return type:
Returns a new
QQuickRenderTarget
referencing an existingrenderTarget
.renderTarget
will in most cases be a QRhiTextureRenderTarget, which allows directing the Qt Quick scene’s rendering into a QRhiTexture.Note
the resulting
QQuickRenderTarget
does not ownrenderTarget
and any underlying 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 referenced resources exists as long as necessary.See also
- isNull()#
- Return type:
bool
Returns true if this
QQuickRenderTarget
is default constructed, referencing no native objects.- mirrorVertically()#
- Return type:
bool
Returns Returns whether the render target is mirrored vertically.
The default value is
false
.See also
- __ne__(rhs)#
- Parameters:
rhs –
QQuickRenderTarget
- Return type:
bool
Returns true if
a
andb
refer to a different set of native objects, or the associated data (size, sample count) does not match.- __eq__(rhs)#
- Parameters:
rhs –
QQuickRenderTarget
- Return type:
bool
Returns true if
a
andb
refer to the same set of native objects and have matching associated data (size, sample count).- setDevicePixelRatio(ratio)#
- Parameters:
ratio – float
Sets the device pixel ratio for this render target to
ratio
. This is the ratio between device pixels and device independent pixels.Note that the specified device pixel ratio value will be ignored if
renderWindow()
is re-implemented to return a valid QWindow.See also
- setMirrorVertically(enable)#
- Parameters:
enable – bool
Sets the size of the render target contents should be mirrored vertically to
enable
when drawing. This allows easy integration of third-party rendering code that does not follow the standard expectations.