diff src/gl-render.cc @ 7907:c350329da645

Implement basic line antialiasing
author John W. Eaton <jwe@octave.org>
date Wed, 09 Jul 2008 11:01:37 -0400
parents b3becd212f3f
children e998e81224b5
line wrap: on
line diff
--- a/src/gl-render.cc	Wed Jul 09 11:00:45 2008 -0400
+++ b/src/gl-render.cc	Wed Jul 09 11:01:37 2008 -0400
@@ -552,6 +552,17 @@
   glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
   glEnable (GL_NORMALIZE);
 
+  if (props.is___enhanced__ ())
+    {
+      glEnable (GL_BLEND);
+      glEnable (GL_LINE_SMOOTH);
+    }
+  else
+    {
+      glDisable (GL_BLEND);
+      glDisable (GL_LINE_SMOOTH);
+    }
+
   // Clear background
 
   Matrix c = props.get_color_rgb ();
@@ -599,6 +610,10 @@
   xform = props.get_transform ();
   
   // draw axes object
+
+  GLboolean antialias;
+  glGetBooleanv (GL_LINE_SMOOTH, &antialias);
+  glDisable (GL_LINE_SMOOTH);
   
   Matrix xlim = xform.xscale (props.get_xlim ().matrix_value ());
   Matrix ylim = xform.yscale (props.get_ylim ().matrix_value ());
@@ -1509,6 +1524,9 @@
 
   // Children
 
+  if (antialias == GL_TRUE)
+    glEnable (GL_LINE_SMOOTH);
+
   Matrix children = props.get_children ();
   std::list<graphics_object> obj_list;
   std::list<graphics_object>::iterator it;
@@ -1678,7 +1696,7 @@
 
       end_marker ();
     }
-
+  
   set_clipping (props.is_clipping ());
 }
 
@@ -2649,7 +2667,7 @@
   glLoadIdentity ();
   glTranslated (tmp(0), tmp(1), -tmp(2));
 
-  if (fc.numel () > 0)
+  if (filled_marker_id > 0 && fc.numel () > 0)
     {
       glColor3dv (fc.data ());
       set_polygon_offset (true, -1.0);
@@ -2664,10 +2682,8 @@
 	  glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
 	}
       set_polygon_offset (false);
-      return;
     }
-
-  if (lc.numel () > 0)
+  else if (marker_id > 0 && lc.numel () > 0)
     {
       glColor3dv (lc.data ());
       glCallList (marker_id);
@@ -2678,6 +2694,11 @@
 opengl_renderer::make_marker_list (const std::string& marker, double size,
 				   bool filled) const
 {
+  char c = marker[0];
+
+  if (filled && (c == '+' || c == 'x' || c == '*' || c == '.'))
+    return 0;
+
   unsigned int ID = glGenLists (1);
   double sz = size * backend.get_screen_resolution () / 72.0;