@@ -179,11 +179,13 @@ sub _lattice_slice {
179179 }
180180}
181181sub PDL ::Graphics::TriD::GObject::_lattice_lines {
182- my ($this , $points ) = @_ ;
182+ my ($this , $points , $colors ) = @_ ;
183183 glDisable(GL_LIGHTING);
184184 glColor3f(0,0,0);
185- PDL::gl_line_strip_nc($points );
186- PDL::gl_line_strip_nc($points -> xchg(1,2));
185+ my $f = ' PDL::gl_line_strip_' . (!defined $colors ? ' nc' : ' col' );
186+ { no strict ' refs' ; $f = \&$f ; }
187+ $f -> ($points , !defined $colors ? () : $colors );
188+ $f -> ($points -> xchg(1,2), !defined $colors ? () : $colors -> xchg(1,2));
187189}
188190
189191sub PDL ::Graphics::TriD::Lattice::gdraw {
@@ -192,8 +194,7 @@ sub PDL::Graphics::TriD::Lattice::gdraw {
192194 if grep $_ -> ndims < 3, $points , $this -> {Colors };
193195 my $shading = $_ [0]{Options }{Shading };
194196 if ($shading == 0) {
195- PDL::gl_line_strip_col($points ,$this -> {Colors });
196- PDL::gl_line_strip_col($points -> xchg(1,2),$this -> {Colors }-> xchg(1,2));
197+ $this -> _lattice_lines($points ,$this -> {Colors });
197198 } else {
198199 glShadeModel($shading == 1 ? GL_FLAT : GL_SMOOTH);
199200 _lattice_slice(\&PDL::gl_triangles, $points , $this -> {Colors });
0 commit comments