QSGEngine¶
Synopsis¶
Functions¶
def
createRenderer
()def
createTextureFromId
(id, size[, options=QSGEngine.CreateTextureOption()])def
createTextureFromImage
(image[, options=QSGEngine.CreateTextureOption()])def
initialize
(context)def
invalidate
()def
rendererInterface
()
Detailed Description¶
A
QSGEngine
can be used to render a tree ofQSGNode
directly on aQWindow
orQOpenGLFramebufferObject
without any integration with QML,QQuickWindow
orQQuickItem
and the convenience that they provide.This means that you must handle event propagation, animation timing, and node lifetime yourself.
Note
This class is for very low level access to an independent scene graph. Most of the time you will instead want to subclass
QQuickItem
and insert yourQSGNode
in a normal QtQuick scene by overridingupdatePaintNode()
.Warning
This class is only suitable when working directly with OpenGL. It is not compatible with the RHI-based rendering path .
See also
- class PySide2.QtQuick.QSGEngine([parent=None])¶
- param parent:
Constructs a new
QSGEngine
with itsparent
- PySide2.QtQuick.QSGEngine.CreateTextureOption¶
The enums are used to customize how a texture is wrapped.
Constant
Description
QSGEngine.TextureHasAlphaChannel
The texture has an alpha channel and should be drawn using blending.
QSGEngine.TextureOwnsGLTexture
The texture object owns the texture id and will delete the GL texture when the texture object is deleted.
QSGEngine.TextureCanUseAtlas
The image can be uploaded into a texture atlas.
QSGEngine.TextureIsOpaque
The texture object is opaque.
- PySide2.QtQuick.QSGEngine.createRenderer()¶
- Return type:
Returns a renderer that can be used to render a
QSGNode
treeYou call
initialize()
first with theQOpenGLContext
that you want to use with this renderer. This will return a null renderer otherwise.
- PySide2.QtQuick.QSGEngine.createTextureFromId(id, size[, options=QSGEngine.CreateTextureOption()])¶
- Parameters:
id –
uint
size –
PySide2.QtCore.QSize
options –
CreateTextureOptions
- Return type:
Creates a texture object that wraps the GL texture
id
uploaded withsize
Valid
options
areTextureHasAlphaChannel
andTextureOwnsGLTexture
The caller takes ownership of the texture object and the texture should only be used with this engine.
- PySide2.QtQuick.QSGEngine.createTextureFromImage(image[, options=QSGEngine.CreateTextureOption()])¶
- Parameters:
image –
PySide2.QtGui.QImage
options –
CreateTextureOptions
- Return type:
Creates a texture using the data of
image
Valid
options
areTextureCanUseAtlas
andTextureIsOpaque
.The caller takes ownership of the texture and the texture should only be used with this engine.
- PySide2.QtQuick.QSGEngine.initialize(context)¶
- Parameters:
context –
PySide2.QtGui.QOpenGLContext
Note
This function is deprecated.
Initialize the engine with
context
.Warning
You have to make sure that you call
makeCurrent()
oncontext
before calling this.
- PySide2.QtQuick.QSGEngine.invalidate()¶
Invalidate the engine releasing its resources
You will have to call
initialize()
andcreateRenderer()
if you want to use it again.
- PySide2.QtQuick.QSGEngine.rendererInterface()¶
- Return type:
Returns the current renderer interface if there is one. Otherwise null is returned.
See also
QSGRenderNode
QSGRendererInterface
© 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.