]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
vro changes to enable antiliasing
authorptv <ptv@opencascade.com>
Mon, 1 Aug 2005 04:23:52 +0000 (04:23 +0000)
committerptv <ptv@opencascade.com>
Mon, 1 Aug 2005 04:23:52 +0000 (04:23 +0000)
src/GLViewer/GLViewer_Drawer.cxx
src/GLViewer/GLViewer_Drawer.h

index 65d0dcf1fbd0383492d810a2617b97acca0c2785..9231804f03fd336952700b1d581bd9dc2f993715 100644 (file)
@@ -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 :
index 22ca4842a7d4f8eed3cb3a438728a0bd710345ef..0a1379cbdf24327dd8569311761bf9f2ce1ba17e 100644 (file)
@@ -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();