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. [Qt3D] QPlaneMesh only one side is visible?
Forum Updated to NodeBB v4.3 + New Features

[Qt3D] QPlaneMesh only one side is visible?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 354 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.
  • Y Offline
    Y Offline
    ymhsieh
    wrote on last edited by
    #1

    Maybe just a silly question. I'm playing with Qt3D and can draw stuff using in-built meshes. However, for QPlaneMesh, it appears to me that just one side of it is visible. Does any one know how to make both sides appear in the rendered scene?

    Thanks...

    U 1 Reply Last reply
    0
    • Y ymhsieh

      Maybe just a silly question. I'm playing with Qt3D and can draw stuff using in-built meshes. However, for QPlaneMesh, it appears to me that just one side of it is visible. Does any one know how to make both sides appear in the rendered scene?

      Thanks...

      U Offline
      U Offline
      ugonight
      wrote on last edited by
      #2

      @ymhsieh Although it may be better to create your own Material, we were able to display both sides of QPhongMaterial with the following code.

      // Material
      auto material = new Qt3DExtras::QPhongMaterial(rootEntity);
      auto cullFront = new Qt3DRender::QCullFace();
      cullFront->setMode(Qt3DRender::QCullFace::NoCulling);
      for (auto tech : material->effect()->techniques()) {
      	for (auto renderPass : tech->renderPasses()) {
      		renderPass->renderStates().removeIf([=](Qt3DRender::QRenderState* renderState) {
      			return dynamic_cast<Qt3DRender::QCullFace*>(renderState) != NULL;
      		});
      		renderPass->addRenderState(cullFront);
      	}
      }
      
      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