Skip to content

Commit b0fcbc0

Browse files
committed
make GObject::lighting
1 parent 95416bd commit b0fcbc0

1 file changed

Lines changed: 12 additions & 8 deletions

File tree

  • lib/PDL/Graphics/TriD

lib/PDL/Graphics/TriD/GL.pm

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,21 +364,25 @@ sub compile_program {
364364
}
365365
$program;
366366
}
367-
sub togl {
368-
my ($this, $points) = @_;
369-
print "togl $this\n" if $PDL::Graphics::TriD::verbose;
370-
glPushAttrib(GL_LIGHTING_BIT | GL_ENABLE_BIT);
371-
glLineWidth($this->{Options}{LineWidth} || 1);
372-
glPointSize($this->{Options}{PointSize} || 1);
373-
glEnable(GL_DEPTH_TEST);
374-
if ($this->{Options}{Lighting}) {
367+
sub lighting {
368+
my ($this, $bool) = @_;
369+
if ($bool) {
375370
glEnable(GL_LIGHTING);
376371
glEnable(GL_LIGHT0);
377372
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
378373
glLightfv_p(GL_LIGHT0,GL_POSITION,1.0,1.0,1.0,0.0);
379374
} else {
380375
glDisable(GL_LIGHTING);
381376
}
377+
}
378+
sub togl {
379+
my ($this, $points) = @_;
380+
print "togl $this\n" if $PDL::Graphics::TriD::verbose;
381+
glPushAttrib(GL_LIGHTING_BIT | GL_ENABLE_BIT);
382+
glLineWidth($this->{Options}{LineWidth} || 1);
383+
glPointSize($this->{Options}{PointSize} || 1);
384+
glEnable(GL_DEPTH_TEST);
385+
$this->lighting($this->{Options}{Lighting});
382386
eval {
383387
$this->gdraw($points // $this->{Points});
384388
};

0 commit comments

Comments
 (0)