diff --git a/src/Gui/MouseSelection.cpp b/src/Gui/MouseSelection.cpp index e75ba52372..655663ff48 100644 --- a/src/Gui/MouseSelection.cpp +++ b/src/Gui/MouseSelection.cpp @@ -55,6 +55,8 @@ void AbstractMouseSelection::grabMouseModel( Gui::View3DInventorViewer* viewer ) { _pcView3D = viewer; m_cPrevCursor = _pcView3D->getWidget()->cursor(); + m_antiAliasing = (int)_pcView3D->getAntiAliasingMode(); + _pcView3D->setAntiAliasingMode(View3DInventorViewer::None); // do initialization of your mousemodel initialize(); @@ -67,6 +69,7 @@ void AbstractMouseSelection::releaseMouseModel() terminate(); _pcView3D->getWidget()->setCursor(m_cPrevCursor); + _pcView3D->setAntiAliasingMode(View3DInventorViewer::AntiAliasing(m_antiAliasing)); _pcView3D = 0; } } diff --git a/src/Gui/MouseSelection.h b/src/Gui/MouseSelection.h index 54d282a4bc..a160d5074e 100644 --- a/src/Gui/MouseSelection.h +++ b/src/Gui/MouseSelection.h @@ -87,6 +87,7 @@ protected: QCursor m_cPrevCursor; int m_iXold, m_iYold; int m_iXnew, m_iYnew; + int m_antiAliasing; SbBool m_bInner; SbBool mustRedraw; std::vector _clPoly; diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 913c800965..3750ac73a9 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -1012,6 +1012,10 @@ void View3DInventorViewer::renderFramebuffer() glEnable(GL_DEPTH_TEST); } +//#define ENABLE_GL_DEPTH_RANGE +// The calls of glDepthRange inside renderScene() causes problems with transparent objects +// so that's why it is disabled now: http://forum.freecadweb.org/viewtopic.php?f=3&t=6037&hilit=transparency + // Documented in superclass. Overrides this method to be able to draw // the axis cross, if selected, and to keep a continuous animation // upon spin. @@ -1051,8 +1055,10 @@ void View3DInventorViewer::renderScene(void) glClearColor(col[0], col[1], col[2], 0.0f); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +#if defined(ENABLE_GL_DEPTH_RANGE) // using 90% of the z-buffer for the background and the main node glDepthRange(0.1,1.0); +#endif // Render our scenegraph with the image. SoGLRenderAction * glra = this->getGLRenderAction(); @@ -1074,16 +1080,20 @@ void View3DInventorViewer::renderScene(void) QObject::tr("Not enough memory available to display the data.")); } +#if defined (ENABLE_GL_DEPTH_RANGE) // using 10% of the z-buffer for the foreground node glDepthRange(0.0,0.1); +#endif // Render overlay front scenegraph. glra->apply(this->foregroundroot); if (this->axiscrossEnabled) { this->drawAxisCross(); } - + +#if defined (ENABLE_GL_DEPTH_RANGE) // using the main portion of z-buffer again (for frontbuffer highlighting) glDepthRange(0.1,1.0); +#endif // Immediately reschedule to get continous spin animation. if (this->isAnimating()) { this->scheduleRedraw(); } diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 15eaaf536f..5051b01f42 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -3338,10 +3338,15 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo viewer->setEditing(TRUE); SoNode* root = viewer->getSceneGraph(); static_cast(root)->selectionRole.setValue(FALSE); + antiAliasing = (int)viewer->getAntiAliasingMode(); + if (antiAliasing != Gui::View3DInventorViewer::None) + viewer->setAntiAliasingMode(Gui::View3DInventorViewer::None); } void ViewProviderSketch::unsetEditViewer(Gui::View3DInventorViewer* viewer) { + if (antiAliasing != Gui::View3DInventorViewer::None) + viewer->setAntiAliasingMode(Gui::View3DInventorViewer::AntiAliasing(antiAliasing)); viewer->setEditing(FALSE); SoNode* root = viewer->getSceneGraph(); static_cast(root)->selectionRole.setValue(TRUE); diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.h b/src/Mod/Sketcher/Gui/ViewProviderSketch.h index f8e71438fb..272edfb3ab 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.h +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.h @@ -264,6 +264,7 @@ protected: // reference coordinates for relative operations double xInit,yInit; bool relative; + int antiAliasing; }; } // namespace PartGui