Skip to content

Commit 78ee1ed

Browse files
committed
use GL_LINE_LOOP for Trigrid Lines
1 parent 9c815e6 commit 78ee1ed

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/PDL/Graphics/TriD/GL.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use OpenGL qw/
1616
GL_FLAT
1717
GL_LIGHTING_BIT GL_POSITION GL_LIGHTING GL_LIGHT0 GL_LIGHT_MODEL_TWO_SIDE
1818
GL_COMPILE GL_ENABLE_BIT GL_DEPTH_TEST GL_TRUE
19-
GL_LINE_STRIP GL_TRIANGLES GL_LINES GL_POINTS
19+
GL_LINE_STRIP GL_TRIANGLES GL_LINES GL_POINTS GL_LINE_LOOP
2020
GL_COLOR_MATERIAL GL_QUADS GL_MODELVIEW GL_PROJECTION
2121
GL_RGB GL_FLOAT GL_UNSIGNED_INT
2222
GL_TEXTURE_2D GL_TEXTURE_MIN_FILTER GL_TEXTURE_MAG_FILTER
@@ -146,6 +146,7 @@ sub PDL::Graphics::TriD::Quaternion::togl {
146146

147147
my %mode2enum = (
148148
linestrip => GL_LINE_STRIP,
149+
lineloop => GL_LINE_LOOP,
149150
);
150151

151152
sub PDL::Graphics::TriD::GObject::togl {

lib/PDL/Graphics/TriD/Objects.pm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ sub new {
150150
if ($options->{Lines}) {
151151
$points = $this->normalise_as($type->r_type,$points);
152152
my $f = $faceidx->dim(1);
153-
my $counts = (PDL->ones(PDL::long, $f) * 4)->flat;
154-
my $starts = (PDL->sequence(PDL::ulong, $f) * 4)->flat;
155-
my $indices = $faceidx->append($faceidx->slice(0))->flat;
156-
$this->add_object(PDL::Graphics::TriD::DrawMulti->new($points, PDL::float(0,0,0)->dummy(1,$points->dim(1)), 'linestrip', $counts, $starts, $indices));
153+
my $counts = (PDL->ones(PDL::long, $f) * 3)->flat;
154+
my $starts = (PDL->sequence(PDL::ulong, $f) * 3)->flat;
155+
my $indices = $faceidx->flat;
156+
$this->add_object(PDL::Graphics::TriD::DrawMulti->new($points, PDL::float(0,0,0)->dummy(1,$points->dim(1)), 'lineloop', $counts, $starts, $indices));
157157
}
158158
$this;
159159
}

0 commit comments

Comments
 (0)