From: ptv Date: Mon, 1 Aug 2005 04:23:52 +0000 (+0000) Subject: vro changes to enable antiliasing X-Git-Tag: T_3_0_2a1~61 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=da961490341b86208c0b7ec9e4c8dc37bea1075b;p=modules%2Fgui.git vro changes to enable antiliasing --- diff --git a/src/GLViewer/GLViewer_Drawer.cxx b/src/GLViewer/GLViewer_Drawer.cxx index 65d0dcf1f..9231804f0 100644 --- a/src/GLViewer/GLViewer_Drawer.cxx +++ b/src/GLViewer/GLViewer_Drawer.cxx @@ -415,6 +415,34 @@ void GLViewer_Drawer::destroyAllTextures() for( ; anIt != anEndIt; anIt++ ) glDeleteTextures( 1, &(anIt.data().myTexFontId) ); } + +//======================================================================= +// Function: setAntialiasing +// Purpose : The function enables and disables antialiasing in Open GL (for points, lines and polygons). +//======================================================================= +void GLViewer_Drawer::setAntialiasing(const bool on) +{ + if (on) + { + glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); + glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); + + glEnable(GL_POINT_SMOOTH); + glEnable(GL_LINE_SMOOTH); + glEnable(GL_POLYGON_SMOOTH); + glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable (GL_BLEND); + } + else + { + glDisable(GL_POINT_SMOOTH); + glDisable(GL_LINE_SMOOTH); + glDisable(GL_POLYGON_SMOOTH); + glBlendFunc (GL_ONE, GL_ZERO); + glDisable (GL_BLEND); + } +} + //====================================================================== // Function: loadTexture // Purpose : diff --git a/src/GLViewer/GLViewer_Drawer.h b/src/GLViewer/GLViewer_Drawer.h index 22ca4842a..0a1379cbd 100644 --- a/src/GLViewer/GLViewer_Drawer.h +++ b/src/GLViewer/GLViewer_Drawer.h @@ -187,6 +187,9 @@ public: //! Returns object priority int getPriority() const { return myPriority; } + + //! The function enables and disables antialiasing in Open GL (for points, lines and polygons). + void setAntialiasing(const bool on); //! Clears all generated textures static void destroyAllTextures();