How to mirror textures while rendering 3D in 5.9?

  • Hi

    I am developing a Qt application in Qt 5.9 on Windows. The application loads and renders 3d files (.dae). I am following the assimp-cpp samples.

    I have come across an bug related to textures where the textures are flipped and displayed. The 3d models are shown incorrectly.

    There is a method in the QTextureImage class setMirrored() that allows us to work-around this bug. The problem is, I am not sure how to do this.

    Here's my code,

    Qt3DRender::QMaterial  *mat = (Qt3DRender::QMaterial  *)(texLoader);
    QVector<Qt3DRender::QParameter *> params = mat->parameters();
    foreach(Qt3DRender::QParameter *param, params)
            QString pname = param->name();
            QVariant var = param->value();
            QVariant::Type mtype = var.type();
            Qt3DRender::QAbstractTexture *tex = (Qt3DRender::QAbstractTexture*) var.value<Qt3DRender::QAbstractTexture*>();
                   QVector<Qt3DRender::QAbstractTextureImage*> teximages = tex->textureImages();
                   foreach(Qt3DRender::QAbstractTextureImage *teximage, teximages)
                             Qt3DRender::QTextureImage *myteximage = qobject_cast<Qt3DRender::QTextureImage*>(teximage);

    I get QAbstractTexture *tex as NULL always.
    What am I missing here?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.