TextureData QML Type

Base type for custom texture data. More...

Import Statement: import QtQuick3D
Instantiates: QQuick3DTextureData
Inherits:

Object3D

Detailed Description

Custom texture data allows using application-generated texture data, that can possibly change dynamically as well. To use custom texture data set the textureData property of Texture to reference a TextureData object.

Custom Texture data is implemented in C++ by creating a QQuick3DTextureData instance, often subclassing it. The QQuick3DTextureData type is registered to QML under the name of TextureData. Once the subclass is registered to QML, Texture objects can start referencing it.

An example of when to use this API is when there is a need to procedurally generate a texture at runtime rather than loading a static image from a file.

import MyCustomTexture 1.0

Model {
    source: "#Cube"
    materials: [
        DefaultMaterial {
            diffuseMap: diffuseMapCustomTexture
        }
    ]
}

Texture {
    id: diffuseMapCustomTexture
    textureData: MyCustomTextureData {

    }
}

See also Texture.

© 2021 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.