Skip to content

Commit d197a93

Browse files
committed
gl_arrows stop emitting lines
1 parent 5750552 commit d197a93

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/PDL/Graphics/OpenGLQ.pd

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,6 @@ broadcastloop %{
184184
PDL_3D_SETVECLEN(norm, w);
185185
PDL_3D_SETVECLEN(norm2, w);
186186
PDL_3D_SETVECLEN(tmp1, 1);
187-
glBegin(GL_LINES);
188-
glVertex3d( $coords(tri => 0, n => a) ,
189-
$coords(tri => 1, n => a) ,
190-
$coords(tri => 2, n => a) );
191-
glVertex3d( $coords(tri => 0, n => b) ,
192-
$coords(tri => 1, n => b) ,
193-
$coords(tri => 2, n => b) );
194-
glEnd();
195187
if(w!=0) {
196188
glBegin(GL_TRIANGLES);
197189
glVertex3d( $coords(tri => 0, n => b) ,

lib/PDL/Graphics/TriD/GL.pm

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,22 +185,28 @@ sub PDL::Graphics::TriD::Lattice::gdraw {
185185
glDisable(GL_LIGHTING);
186186
glColor3d(1,1,1);
187187
PDL::Graphics::OpenGLQ::gl_arrows($arrows, 0, 1, 0.5, 0.02);
188+
PDL::gl_lines_col($arrows,[1,1,1]);
188189
}
189190
if (defined $this->{FaceNormals}) {
190191
my $facecentres = $faces->transpose->avgover;
191192
my $facearrows = $facecentres->append($facecentres + $this->{FaceNormals}*0.1)->splitdim(0,3);
192193
glDisable(GL_LIGHTING);
193194
glColor3d(0.5,0.5,0.5);
194195
PDL::Graphics::OpenGLQ::gl_arrows($facearrows, 0, 1, 0.5, 0.02);
196+
PDL::gl_lines_col($facearrows,[0.5,0.5,0.5]);
195197
}
196198
}
197199
}
198200

199201
sub PDL::Graphics::TriD::Arrows::gdraw {
200202
my($this,$points) = @_;
201-
glColor3d(@{$this->{Options}{Color}});
202-
PDL::Graphics::OpenGLQ::gl_arrows($points,@{$this->{Options}}{qw(From To
203+
my $opts = $this->{Options};
204+
glColor3d(@{$opts->{Color}});
205+
my ($from, $to) = @$opts{qw(From To)};
206+
PDL::Graphics::OpenGLQ::gl_arrows($points,$from,$to,@$opts{qw(
203207
ArrowLen ArrowWidth)});
208+
my $lines = $points->dice_axis(1,$from)->append($points->dice_axis(1,$to))->splitdim(0,3);
209+
PDL::gl_lines_col($lines,$opts->{Color});
204210
}
205211

206212
sub PDL::Graphics::TriD::LineStrip::gdraw {
@@ -258,13 +264,15 @@ sub PDL::Graphics::TriD::Trigrid::gdraw {
258264
glDisable(GL_LIGHTING);
259265
glColor3d(1,1,1);
260266
PDL::Graphics::OpenGLQ::gl_arrows($arrows, 0, 1, 0.5, 0.02);
267+
PDL::gl_lines_col($arrows,[1,1,1]);
261268
}
262269
if (defined $this->{FaceNormals}) {
263270
my $facecentres = $faces->transpose->avgover;
264271
my $facearrows = $facecentres->append($facecentres + $this->{FaceNormals}*0.1)->splitdim(0,3);
265272
glDisable(GL_LIGHTING);
266273
glColor3d(0.5,0.5,0.5);
267274
PDL::Graphics::OpenGLQ::gl_arrows($facearrows, 0, 1, 0.5, 0.02);
275+
PDL::gl_lines_col($facearrows,[0.5,0.5,0.5]);
268276
}
269277
}
270278
if ($options->{Lines}) {

0 commit comments

Comments
 (0)