Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to mirror textures while rendering 3D in 5.9?
Forum Updated to NodeBB v4.3 + New Features

How to mirror textures while rendering 3D in 5.9?

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 389 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    poortipant
    wrote on last edited by
    #1

    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*>();
            if(tex)
            {
                   QVector<Qt3DRender::QAbstractTextureImage*> teximages = tex->textureImages();
                   foreach(Qt3DRender::QAbstractTextureImage *teximage, teximages)
                   {
                             Qt3DRender::QTextureImage *myteximage = qobject_cast<Qt3DRender::QTextureImage*>(teximage);
                             if(myteximage)
                             {
                                        myteximage->setMirrored(true);
                             }
                   }
           }
    }
    

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

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved