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 Opacity control on primitives?

Qt3D Opacity control on primitives?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.4k 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.
  • F Offline
    F Offline
    fireking
    wrote on last edited by
    #1

    How to I set level of opacity when rendering QGLSphere or QGLCube primitives?

    I'm building geometry using QGLBuilder:
    @
    QGLBuilder builder;
    builder << QGL::Faceted;

    if ( currentShape == sphere )
        builder << QGLSphere(0.99,3);  // size of 1, smooth
    else if ( currentShape == cube )
        builder << QGLCube(1.0);  // size of 1, smooth
    
    // Finalise geometry and get QGLSceneNode pointer.
    QGLSceneNode *thisNode = builder.finalizedSceneNode();
    

    @

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fireking
      wrote on last edited by
      #2

      Figured it out... use alpha blending with color.

      @
      void CubeView::initializeGL(QGLPainter *painter)
      {
      glEnable(GL_BLEND);
      }
      @

      and setAlpha in paintGL...

      @
      QColor colour = QColor(VisualDataItem->getFinalColour());
      colour.setAlpha(127);
      painter->setFaceColor(QGL::AllFaces, colour);

      VisualDataItem->getNode()->draw(painter);
      @

      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