QSGAbstractRenderer

QSGAbstractRenderer gives access to the scene graph nodes and rendering of a QSGEngine . More

Inheritance diagram of PySide2.QtQuick.QSGAbstractRenderer

Synopsis

Functions

Virtual functions

Signals

Detailed Description

A QSGAbstractRenderer created by a QSGEngine allows you to set your QSGNode tree through setRootNode() and control the rendering viewport through setDeviceRect() , setViewportRect() and setProjectionMatrixToRect() . You can finally trigger the rendering to the desired framebuffer through renderScene() .

The QSGAbstractRenderer is only available when used with a QSGEngine and isn’t exposed when used internally by QQuickWindow .

See also

QSGEngine QSGNode

class PySide2.QtQuick.QSGAbstractRenderer([parent=None])
Parameters

parentPySide2.QtCore.QObject

PySide2.QtQuick.QSGAbstractRenderer.ClearModeBit

Used with setClearMode() to indicate which buffer should be cleared before the scene render.

Constant

Description

QSGAbstractRenderer.ClearColorBuffer

Clear the color buffer using clearColor() .

QSGAbstractRenderer.ClearDepthBuffer

Clear the depth buffer.

QSGAbstractRenderer.ClearStencilBuffer

Clear the stencil buffer.

PySide2.QtQuick.QSGAbstractRenderer.MatrixTransformFlag

Used with setProjectionMatrixToRect() to indicate the expectations towards the generated projection matrix.

Constant

Description

QSGAbstractRenderer.MatrixTransformFlipY

The traditional assumption in Qt Quick is that Y points up in the normalized device coordinate system. There is at least one modern graphics API where this is not the case (Vulkan). This flag can then be used to get a projection that is appropriate for such an API.

New in version 5.14.

PySide2.QtQuick.QSGAbstractRenderer.clearColor()
Return type

PySide2.QtGui.QColor

Returns the color that clears the framebuffer at the beginning of the rendering.

PySide2.QtQuick.QSGAbstractRenderer.clearMode()
Return type

ClearMode

Flags defining which attachment of the framebuffer will be cleared before each scene render.

PySide2.QtQuick.QSGAbstractRenderer.deviceRect()
Return type

PySide2.QtCore.QRect

Returns the device rect of the surface being rendered to.

See also

setDeviceRect()

PySide2.QtQuick.QSGAbstractRenderer.nodeChanged(node, state)
Parameters
PySide2.QtQuick.QSGAbstractRenderer.projectionMatrix()
Return type

PySide2.QtGui.QMatrix4x4

Returns the projection matrix

PySide2.QtQuick.QSGAbstractRenderer.projectionMatrixWithNativeNDC()
Return type

PySide2.QtGui.QMatrix4x4

PySide2.QtQuick.QSGAbstractRenderer.renderScene([fboId=0])
Parameters

fboIduint

Render the scene to the specified fboId

If fboId isn’t specified, the scene graph will be rendered to the default framebuffer. You will have to call swapBuffers() yourself afterward.

The framebuffer specified by fboId will be bound automatically.

See also

swapBuffers() handle()

PySide2.QtQuick.QSGAbstractRenderer.sceneGraphChanged()
PySide2.QtQuick.QSGAbstractRenderer.setClearColor(color)
Parameters

colorPySide2.QtGui.QColor

Use color to clear the framebuffer when clearMode() is set to ClearColorBuffer .

PySide2.QtQuick.QSGAbstractRenderer.setClearMode(mode)
Parameters

modeClearMode

Defines which attachment of the framebuffer should be cleared before each scene render with the mode flag.

PySide2.QtQuick.QSGAbstractRenderer.setDeviceRect(rect)
Parameters

rectPySide2.QtCore.QRect

PySide2.QtQuick.QSGAbstractRenderer.setDeviceRect(size)
Parameters

sizePySide2.QtCore.QSize

PySide2.QtQuick.QSGAbstractRenderer.setProjectionMatrix(matrix)
Parameters

matrixPySide2.QtGui.QMatrix4x4

Use matrix to project the QSGNode coordinates onto surface pixels.

PySide2.QtQuick.QSGAbstractRenderer.setProjectionMatrixToRect(rect)
Parameters

rectPySide2.QtCore.QRectF

Convenience method that calls setProjectionMatrix() with an orthographic matrix generated from rect .

Note

This function assumes that the graphics API uses Y up in its normalized device coordinate system.

PySide2.QtQuick.QSGAbstractRenderer.setProjectionMatrixToRect(rect, flags)
Parameters

Convenience method that calls setProjectionMatrix() with an orthographic matrix generated from rect .

Set MatrixTransformFlipY in flags when the graphics API uses Y down in its normalized device coordinate system (for example, Vulkan).

PySide2.QtQuick.QSGAbstractRenderer.setProjectionMatrixWithNativeNDC(matrix)
Parameters

matrixPySide2.QtGui.QMatrix4x4

PySide2.QtQuick.QSGAbstractRenderer.setViewportRect(rect)
Parameters

rectPySide2.QtCore.QRect

PySide2.QtQuick.QSGAbstractRenderer.setViewportRect(size)
Parameters

sizePySide2.QtCore.QSize

PySide2.QtQuick.QSGAbstractRenderer.viewportRect()
Return type

PySide2.QtCore.QRect

Returns the rect of the viewport to render.