The purpose of the texture factory is to provide a placeholder for a image data that can be converted into an OpenGL texture.
Creating a texture directly is not possible as there is rarely an OpenGL context available in the thread that is responsible for loading the image data.
- class PySide2.QtQuick.QQuickTextureFactory¶
Constructs a texture factory. Since
QQuickTextureFactoryis abstract, it cannot be instantiated directly.
This function is called on the scene graph rendering thread to create a
QSGTextureinstance from the factory.
windowprovides the context which this texture is created in.
QML will internally cache the returned texture as needed. Each call to this function should return a unique instance.
The OpenGL context used for rendering is bound when this function is called.
- Return type:
Returns an image version of this texture.
The lifespan of the returned image is unknown, so the implementation should return a self contained
QImage, not make use of the
QImage(uchar *, …) constructor.
This function is not commonly used and is expected to be slow.
- Return type:
Returns the number of bytes of memory the texture consumes.
- static PySide2.QtQuick.QQuickTextureFactory.textureFactoryForImage(image)¶
QQuickTextureFactoryholding the given
This is typically used as a helper in
© 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.