QtDataVisualization - semi-transparent QSurface3DSeries



  • Hello dear community! I need render two figures (ellipsoids) which can cross, so it must be semi-transparent. To solve my problem I tried to use Q3DSurface and QSurface3DSerier with setting baseColor property for the QSurface3DSeries with alpha value. But It doesn't work for me.
    I made some test (low-cost) project, with drawing "roof", to try accepting alpha values, but that doesn't work either.

    Test code:

    // Init memory
      Q3DSurface *poSurface = new Q3DSurface();
      QSurface3DSeries *poSeries = new QSurface3DSeries();
      QSurfaceDataArray *poDataArray = new QSurfaceDataArray();
    
      // Generating test surface series
      for ( int i = 0, k = 0; i < 10; ++i)
      {
        QSurfaceDataRow *poRow = new QSurfaceDataRow();
    
        for ( int j = 0; j < 10; ++j )
        {
          float x = j;
          float y = i;
          float z = k;
          poRow->append( QSurfaceDataItem( QVector3D( x, y, z ) ) );
        }
        poDataArray->append( poRow );
    
        if ( i % 2 == 0 )
        {
          ++k;
        }
      }
    
      //
      poSeries->dataProxy()->resetArray( poDataArray );
      poSurface->addSeries( poSeries );
    
      // Setting color with alpha value
      poSeries->setBaseColor( QColor( 100, 100, 100, 100 ));
    
      // Show surface widget
      QWidget *poWidget = QWidget::createWindowContainer( poSurface );
      poWidget->setWindowTitle( "test ");
      poWidget->show();
    

    I expected to see semi-transparent gray surface, but...
    alt text

    What I have to do, to make my surfaces semi-transparent? Thanks!


Log in to reply