comparison libinterp/corefcn/gl-render.cc @ 18701: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 44f0d1a53ead
children ea22cf3e370b
comparison
equal deleted inserted replaced
18700:26c87537ab42 18701:8969bd721448
2276 { 2276 {
2277 int idx = int (f(i,j) - 1); 2277 int idx = int (f(i,j) - 1);
2278 2278
2279 Matrix vv (1, 3, 0.0); 2279 Matrix vv (1, 3, 0.0);
2280 Matrix cc; 2280 Matrix cc;
2281 Matrix nn(1, 3, 0.0); 2281 Matrix nn (1, 3, 0.0);
2282 double aa = 1.0; 2282 double aa = 1.0;
2283 2283
2284 vv(0) = v(idx,0); vv(1) = v(idx,1); 2284 vv(0) = v(idx,0); vv(1) = v(idx,1);
2285 if (has_z) 2285 if (has_z)
2286 vv(2) = v(idx,2); 2286 vv(2) = v(idx,2);
2337 2337
2338 if (fl_mode > 0) 2338 if (fl_mode > 0)
2339 glEnable (GL_LIGHTING); 2339 glEnable (GL_LIGHTING);
2340 2340
2341 // FIXME: use __index__ property from patch object 2341 // FIXME: use __index__ property from patch object
2342 patch_tesselator tess (this, fc_mode, fl_mode, 0); 2342 // -1.25 chosen to provide sufficient Z-offset for
2343 // 'layer' property of 2-D plots and not to provoke
2344 // Z-fighting with tesselator outline.
2345 patch_tesselator tess (this, fc_mode, fl_mode, -1.25);
2343 2346
2344 for (int i = 0; i < nf; i++) 2347 for (int i = 0; i < nf; i++)
2345 { 2348 {
2346 if (clip_f(i)) 2349 if (clip_f(i))
2347 continue; 2350 continue;