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. Wrapping Texture on CuboidMesh
Forum Updated to NodeBB v4.3 + New Features

Wrapping Texture on CuboidMesh

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt3d
1 Posts 1 Posters 366 Views 1 Watching
  • 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.
  • Zee_07Z Offline
    Zee_07Z Offline
    Zee_07
    wrote on last edited by
    #1

    Currently if i am applying texture on CuboidMesh it displays same texture image on each side of cuboid rather than wrapping the whole cuboid.
    For example I want to make a dice but with fallowing code it display all the dots of dice (whole texture image) on each side. Fallowing is my code snippet:

    Qt3DExtras::QCuboidMesh *cuboid = new Qt3DExtras::QCuboidMesh();
       cuboid->setXExtent(2);
        cuboid->setYExtent(2);
        cuboid->setZExtent(2);
     Qt3DExtras::QTextureMaterial   *cuboidMaterial = new Qt3DExtras::QTextureMaterial  ();
    
        Qt3DRender::QTexture3D  *texture2d = new Qt3DRender::QTexture2D ();
        texture2d->setWidth(20);
        texture2d->setHeight(20);
        texture2d->setFormat(Qt3DRender::QAbstractTexture::TextureFormat::RGB8_UNorm);
        texture2d->setGenerateMipMaps(true);
        texture2d->setMagnificationFilter(Qt3DRender::QAbstractTexture::Filter::Linear);
        texture2d->setMinificationFilter(Qt3DRender::QAbstractTexture::Filter::LinearMipMapLinear);
        texture2d->setWrapMode(Qt3DRender::QTextureWrapMode(Qt3DRender::QTextureWrapMode::ClampToEdge));
    
        Qt3DRender::QTextureImage *diffuseImage = new Qt3DRender::QTextureImage();
        diffuseImage->setSource(QUrl::fromLocalFile("ex.png"));
    
        texture2d->addTextureImage(diffuseImage);
    
        cuboidMaterial->setTexture(texture2d);
    

    Thanks and Kind Regards,
    Zee_07

    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