Is it possible to send to a QImage data from a compressed texture directly in qml?
Right now I'm having the following code :
Image
{
anchors.fill: parent
fillMode : Image.Stretch
source : "Textures/BG_png.png"
}
Then, I create images having sources with various formats , more precisely :
// uncompressed
source : "Textures/BG_RGB565.dds"
source : "Textures/BG_RGB888.dds"
source : "Textures/BG_RGBA8888.dds"
//compressed
source : "Textures/BG_ETC1.ktx"
source : "Textures/BG_ETC1.pkm"
source : "Textures/BG_ETC1.dds"
source : "Textures/BG_PVR.pvr"
source : "Textures/BG_ASTC.astc"
I'm getting the following error "QML Image : invalid image data" for every source type except BG_RGB565.dds (and only with the ".dds" extension).
I the following questions :
why does RGB565.dds work and RGB888 or other uncompressed formats don't ?
what OpenGL image types do QT QML support, and how do you hint the Image class that it's source is encoded / compressed in a certain way using QML only ?
You'll have to implement this yourself using a QQuickImageProvider.
Set the QQuickImageProvider's type to:
QQmlImageProviderBase::Texture
Then return a QSGTextureProvider
from requestTexture(const QString &id, QSize *size, const QSize &requestedSize)
See more details here: https://doc.qt.io/qt-5/qquickimageprovider.html
Currently the only supported formats that Image {} supports is: https://doc.qt.io/qt-5/qtimageformats-index.html
It might be possible to load it from Qt3D, but I'm not sure if these formats are supported.