From ec36fac7ace7bc4e24dc239602abda6880ca4308 Mon Sep 17 00:00:00 2001 From: Viktor UZLOV Date: Wed, 5 May 2021 16:43:24 +0300 Subject: [PATCH] fix transparency objects --- src/Qtx/Qtx.cxx | 17 +++++++++++------ src/SVTK/SVTK_ViewWindow.cxx | 3 ++- src/VTKViewer/VTKViewer_OpenGLRenderer.cxx | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Qtx/Qtx.cxx b/src/Qtx/Qtx.cxx index 28cf2c3bc..3bbc67007 100644 --- a/src/Qtx/Qtx.cxx +++ b/src/Qtx/Qtx.cxx @@ -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); diff --git a/src/SVTK/SVTK_ViewWindow.cxx b/src/SVTK/SVTK_ViewWindow.cxx index 2208dda16..67fccd088 100644 --- a/src/SVTK/SVTK_ViewWindow.cxx +++ b/src/SVTK/SVTK_ViewWindow.cxx @@ -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(); diff --git a/src/VTKViewer/VTKViewer_OpenGLRenderer.cxx b/src/VTKViewer/VTKViewer_OpenGLRenderer.cxx index d0b6acff7..042458467 100644 --- a/src/VTKViewer/VTKViewer_OpenGLRenderer.cxx +++ b/src/VTKViewer/VTKViewer_OpenGLRenderer.cxx @@ -199,7 +199,7 @@ void VTKViewer_OpenGLRenderer::Clear(void) glClearColor( static_cast(this->Background[0]), static_cast(this->Background[1]), static_cast(this->Background[2]), - static_cast(1.0)); + static_cast(this->BackgroundAlpha)); clear_mask |= GL_COLOR_BUFFER_BIT; } -- 2.39.2