@@ -544,7 +544,7 @@ my $fragment_shader = join '', @SHADERBITS{qw(version
544544my %SPHERE ;
545545my @KEYS = qw( vertices normals idx) ;
546546sub togl_setup {
547- my ($this , $points , $material ) = @_ ;
547+ my ($this , $points , $uniforms ) = @_ ;
548548 print " togl_setup $this \n " if $PDL::Graphics::TriD::verbose ;
549549 @SPHERE {@KEYS } = gl_sphere(0.025, 15, 15) if !keys %SPHERE ;
550550 @{ $this -> {Impl } }{@KEYS } = @SPHERE {@KEYS };
@@ -556,8 +556,7 @@ sub togl_setup {
556556 $this -> load_attrib(position => $this -> {Impl }{vertices });
557557 $this -> load_attrib(normal => $this -> {Impl }{normals });
558558 $this -> set_uniform(lightind => ' 1i' => [0]);
559- my $u = $material -> to_uniforms;
560- $this -> set_uniform($_ => @{ $u -> {$_ } }) for sort keys %$u ;
559+ $this -> set_uniform($_ => @{ $uniforms -> {$_ } }) for sort keys %$uniforms ;
561560 $this -> load_idx_buffer(indx_buf => $this -> {Impl }{idx });
562561 }
563562 $this -> {Impl }{offset_loc } = $this -> load_attrib(offset => $points );
@@ -607,7 +606,7 @@ my %frag = (
607606 tex_flat => join (' ' , $frag_header , $frag_tex , $frag_flat ),
608607);
609608sub togl_setup {
610- my ($this , $points , $material ) = @_ ;
609+ my ($this , $points , $uniforms ) = @_ ;
611610 print " togl_setup $this \n " if $PDL::Graphics::TriD::verbose ;
612611 my $shading = $this -> {Options }{Shading };
613612 my $lightflat = $shading > 2 ? ' light' : ' flat' ;
@@ -630,9 +629,8 @@ sub togl_setup {
630629 if ($shading > 2) {
631630 $this -> load_attrib(normal => $this -> {Normals });
632631 $this -> set_uniform(lightind => ' 1i' => [0]);
633- my $u = $material -> to_uniforms;
634- $this -> set_uniform($_ => @{ $u -> {$_ } }) for sort keys %$u ;
635632 }
633+ $this -> set_uniform($_ => @{ $uniforms -> {$_ } }) for sort keys %$uniforms ;
636634 $this -> togl_unbind;
637635}
638636sub gdraw {
@@ -888,7 +886,7 @@ sub display {
888886 print " VALID $this =$this ->{IsValid}\n " if $PDL::Graphics::TriD::verbose ;
889887 if (!$vp -> {IsValid }) {
890888 glpSetAutoCheckErrors(1);
891- $vp -> togl_setup(undef , $vp -> {DefMaterial });
889+ $vp -> togl_setup(undef , $vp -> {DefMaterial }-> to_uniforms );
892890 print " VALID1 $vp \n " if $PDL::Graphics::TriD::verbose ;
893891 $vp -> {IsValid } = 1;
894892 }
0 commit comments