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
QSGEnginecan be used to render a tree ofQSGNodedirectly on aQWindoworQOpenGLFramebufferObjectwithout any integration with QML,QQuickWindoworQQuickItemand 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
QQuickItemand insert yourQSGNodein 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
QSGEnginewith 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
QSGNodetreeYou call
initialize()first with theQOpenGLContextthat 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 –
uintsize –
PySide2.QtCore.QSizeoptions –
CreateTextureOptions
- Return type:
Creates a texture object that wraps the GL texture
iduploaded withsizeValid
optionsareTextureHasAlphaChannelandTextureOwnsGLTextureThe 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.QImageoptions –
CreateTextureOptions
- Return type:
Creates a texture using the data of
imageValid
optionsareTextureCanUseAtlasandTextureIsOpaque.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()oncontextbefore 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
QSGRenderNodeQSGRendererInterface
© 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.