# HG changeset patch # User Rik # Date 1400448024 25200 # Node ID be8d7721ac16058852e5446f021f593672555cc0 # Parent ff39ddf84a1972b0132198d5b58f02c69ca81695 Use OpenGL line smoothing when multisample is not available. * gl-render.cc (opengl_renderer::init_gl_context): Check whether multisample is enabled and use GL_LINE_SMOOTH if it is not. * gl-render.cc (opengl_renderer::setup_opengl_transformation). Remove call to disable GL_LINE_SMOOTH. * gl-render.cc (opengl_renderer::draw_axes_children): Remove call to enable GL_LINE_SMOOTH. * gl-render.cc (opengl_renderer::draw_axes): Disable GL_LINE_SMOOTH for axes lines, but re-enable for axes children. diff -r ff39ddf84a19 -r be8d7721ac16 libinterp/corefcn/gl-render.cc --- a/libinterp/corefcn/gl-render.cc Sat May 17 13:17:47 2014 -0700 +++ b/libinterp/corefcn/gl-render.cc Sun May 18 14:20:24 2014 -0700 @@ -622,7 +622,17 @@ if (enhanced) { glEnable (GL_BLEND); - glEnable (GL_LINE_SMOOTH); + glEnable (GL_MULTISAMPLE); + GLint iMultiSample, iNumSamples; + glGetIntegerv (GL_SAMPLE_BUFFERS, &iMultiSample); + glGetIntegerv (GL_SAMPLES, &iNumSamples); + if (iMultiSample != GL_TRUE || iNumSamples == 0) + { + // MultiSample not implemented. Use old-style anti-aliasing + glDisable (GL_MULTISAMPLE); + glEnable (GL_LINE_SMOOTH); + glHint (GL_LINE_SMOOTH_HINT, GL_NICEST); + } } else { @@ -817,8 +827,6 @@ glClear (GL_DEPTH_BUFFER_BIT); - glDisable (GL_LINE_SMOOTH); - // store axes transformation data xform = props.get_transform (); @@ -1340,12 +1348,6 @@ { // Children - GLboolean antialias; - glGetBooleanv (GL_LINE_SMOOTH, &antialias); - - if (antialias == GL_TRUE) - glEnable (GL_LINE_SMOOTH); - Matrix children = props.get_all_children (); std::list obj_list; std::list::iterator it; @@ -1429,6 +1431,12 @@ setup_opengl_transformation (props); + // Disable line smoothing for axes + GLboolean antialias; + glGetBooleanv (GL_LINE_SMOOTH, &antialias); + if (antialias == GL_TRUE) + glDisable (GL_LINE_SMOOTH); + // draw axes object draw_axes_planes (props); @@ -1444,6 +1452,10 @@ set_clipbox (x_min, x_max, y_min, y_max, z_min, z_max); + // Re-enable line smoothing for children + if (antialias == GL_TRUE) + glEnable (GL_LINE_SMOOTH); + draw_axes_children (props); }