changeset 18702:8969bd721448

Fix Z-depth issues of patches and lines in 2-D plots (bug #40722). * gl-render.cc (draw_patch): Call patch_tesselator constructor with a negative Z-offset for glPolygonOffset to pull it forward of line objects at Z=0.
author Rik <rik@octave.org>
date Tue, 29 Apr 2014 11:39:58 -0700
parents 26c87537ab42
children abd8d8c686c9
files libinterp/corefcn/gl-render.cc
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc	Sun Apr 27 23:22:33 2014 +0200
+++ b/libinterp/corefcn/gl-render.cc	Tue Apr 29 11:39:58 2014 -0700
@@ -2278,7 +2278,7 @@
 
         Matrix vv (1, 3, 0.0);
         Matrix cc;
-        Matrix nn(1, 3, 0.0);
+        Matrix nn (1, 3, 0.0);
         double aa = 1.0;
 
         vv(0) = v(idx,0); vv(1) = v(idx,1);
@@ -2339,7 +2339,10 @@
             glEnable (GL_LIGHTING);
 
           // FIXME: use __index__ property from patch object
-          patch_tesselator tess (this, fc_mode, fl_mode, 0);
+          // -1.25 chosen to provide sufficient Z-offset for
+          // 'layer' property of 2-D plots and not to provoke
+          // Z-fighting with tesselator outline.
+          patch_tesselator tess (this, fc_mode, fl_mode, -1.25);
 
           for (int i = 0; i < nf; i++)
             {