# HG changeset patch # User John W. Eaton # Date 1215615697 14400 # Node ID c350329da645ed0589aefb142e6a2843b7694620 # Parent b3becd212f3fe2fa1ea098351d9995d4d8fb86a6 Implement basic line antialiasing diff -r b3becd212f3f -r c350329da645 src/ChangeLog --- a/src/ChangeLog Wed Jul 09 11:00:45 2008 -0400 +++ b/src/ChangeLog Wed Jul 09 11:01:37 2008 -0400 @@ -1,5 +1,13 @@ 2008-07-09 Michael Goffioul + * gl-render.cc (opengl_renderer::draw(figure)): Enable line smoothing + according to __enhanced__ property. + (opengl_renderer::draw_marker): Only draw markers with valid call + lists ID. + (opengl_renderer::make_marker_list): Do not produce filled marker call + list for non-fillable markers. + (opengl_renderer::draw(axes)): Do not antialias axes system. + * gl-render.cc (opengl_renderer::set_polygon_offset): Also enable polygon offseting in GL_LINE mode. (opengl_renderer::draw_marker): Offset markers foward instead of diff -r b3becd212f3f -r c350329da645 src/gl-render.cc --- 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 obj_list; std::list::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;