]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix problem with rendering transparent objects in VTK viewer
authorViktor UZLOV <vuzlov@salomex.nnov.opencascade.com>
Wed, 5 May 2021 13:43:24 +0000 (16:43 +0300)
committervsr <vsr@opencascade.com>
Wed, 5 May 2021 14:12:10 +0000 (17:12 +0300)
src/Qtx/Qtx.cxx
src/SVTK/SVTK_ViewWindow.cxx
src/VTKViewer/VTKViewer_OpenGLRenderer.cxx

index 28cf2c3bcd048a049fb7648f8e9928da1e15aa9b..3bbc6700735bc44b72659e8141d567d68b87389b 100644 (file)
@@ -2237,12 +2237,17 @@ Qt::HANDLE Qtx::getVisual()
   // Find an appropriate visual
 
   int doubleBufferVisual[]  = {
-    GLX_RGBA,           // Needs to support OpenGL
-    GLX_DEPTH_SIZE, 16, // Needs to support a 16 bit depth buffer
-    GLX_DOUBLEBUFFER,   // Needs to support double-buffering
-    GLX_STEREO,         // Needs to support stereo rendering
+    GLX_RENDER_TYPE, GLX_RGBA_BIT, // Needs to support OpenGL
+    GLX_RED_SIZE, 1,
+    GLX_GREEN_SIZE, 1,
+    GLX_BLUE_SIZE, 1,
+    GLX_ALPHA_SIZE, 1,
+    GLX_DEPTH_SIZE, 16,    // Needs to support a 16 bit depth buffer
+    GLX_DOUBLEBUFFER, 1,   // Needs to support double-buffering
+    GLX_STEREO, 1,         // Needs to support stereo rendering
     GLX_STENCIL_SIZE, 1,
-    None                // end of list
+    0x20B2, 1,             // Needs to support srgb profile
+    None                   // end of list
   };
 
   // Try for the double-bufferd visual first
@@ -2285,7 +2290,7 @@ void Qtx::initDefaultSurfaceFormat()
 #ifdef WIN32
   fmt.setAlphaBufferSize(0);
 #else
-  fmt.setAlphaBufferSize(1);
+  fmt.setAlphaBufferSize(0);
 #endif
   fmt.setStereo(false);
   fmt.setSamples(0);
index 2208dda1692053b8ac825bc2afae7fb498475b08..67fccd08850c5fb0df3c1792a9bc612a695e30a7 100644 (file)
@@ -252,7 +252,8 @@ void SVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel)
                                         myEventCallbackCommand.GetPointer(), 0.0);
 
 
-
+  getRenderer()->SetBackgroundAlpha(1.0);
+  myInteractor->getRenderWindow()->SetMultiSamples(0);
   myInteractor->getRenderWindow()->Render();
   setBackground( Qtx::BackgroundData( Qt::black ) ); // set default background
   onResetView();
index d0b6acff76048b8d7e86513cd9c2badb2da59812..042458467679f82826a73a6aa9994052c7f41bc2 100644 (file)
@@ -199,7 +199,7 @@ void VTKViewer_OpenGLRenderer::Clear(void)
     glClearColor( static_cast<GLclampf>(this->Background[0]),
                   static_cast<GLclampf>(this->Background[1]),
                   static_cast<GLclampf>(this->Background[2]),
-                  static_cast<GLclampf>(1.0));
+                  static_cast<GLclampf>(this->BackgroundAlpha));
     clear_mask |= GL_COLOR_BUFFER_BIT;
   }