Mercurial > hg > octave-nkf
changeset 18959:be8d7721ac16
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.
author | Rik <rik@octave.org> |
---|---|
date | Sun, 18 May 2014 14:20:24 -0700 |
parents | ff39ddf84a19 |
children | 79f69742971a |
files | libinterp/corefcn/gl-render.cc |
diffstat | 1 files changed, 21 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc +++ b/libinterp/corefcn/gl-render.cc @@ -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<graphics_object> obj_list; std::list<graphics_object>::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); }