def
createRenderer
()
def
createTextureFromId
(id, size[, options=QSGEngine.CreateTextureOption()])
def
createTextureFromImage
(image[, options=QSGEngine.CreateTextureOption()])
def
initialize
(context)
def
invalidate
()
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.
注意
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().警告
This class is only suitable when working directly with OpenGL. It is not compatible with the RHI-based rendering path .
另请参阅
PySide2.QtQuick.QSGEngine.
CreateTextureOption
¶
The enums are used to customize how a texture is wrapped.
|
常量 |
描述 |
|---|---|
|
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
(
)
¶
Returns a renderer that can be used to render a
QSGNode
tree
You call
initialize()
first with the
QOpenGLContext
that you want to use with this renderer. This will return a null renderer otherwise.
PySide2.QtQuick.QSGEngine.
createTextureFromId
(
id
,
size
[
,
options=QSGEngine.CreateTextureOption()
]
)
¶
id
–
uint
size
–
QSize
options
–
CreateTextureOptions
Creates a texture object that wraps the GL texture
id
uploaded with
size
Valid
options
are
TextureHasAlphaChannel
and
TextureOwnsGLTexture
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()
]
)
¶
image
–
QImage
options
–
CreateTextureOptions
Creates a texture using the data of
image
Valid
options
are
TextureCanUseAtlas
and
TextureIsOpaque
.
The caller takes ownership of the texture and the texture should only be used with this engine.
PySide2.QtQuick.QSGEngine.
initialize
(
context
)
¶
context
–
QOpenGLContext
注意
此函数被弃用。
Initialize the engine with
context
.
警告
You have to make sure that you call
makeCurrent()
on
context
before calling this.
PySide2.QtQuick.QSGEngine.
invalidate
(
)
¶
Invalidate the engine releasing its resources
You will have to call
initialize()
and
createRenderer()
if you want to use it again.