Skip to content

Commit 8ff1cfc

Browse files
committed
::Window in GL mode use Impl field for GL window object
1 parent 5c6c323 commit 8ff1cfc

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

lib/PDL/Graphics/TriD/GL.pm

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -769,14 +769,14 @@ use OpenGL::Modern qw/
769769
/;
770770

771771
use base qw/PDL::Graphics::TriD::Object/;
772-
use fields qw/Ev Width Height Interactive _GLObject
772+
use fields qw/Ev Width Height Interactive
773773
_ViewPorts _CurrentViewPort /;
774774

775775
my @GL_VERSION_NEEDED = (3, 3, 1);
776776
sub gdriver {
777777
my($this, $options) = @_;
778778
print "GL gdriver...\n" if $PDL::Graphics::TriD::verbose;
779-
if (defined $this->{_GLObject}) {
779+
if (defined $this->{Impl}) {
780780
print "WARNING: Graphics Driver already defined for this window \n";
781781
return;
782782
}
@@ -786,8 +786,8 @@ sub gdriver {
786786
'PDL::Graphics::TriD::GL::GLFW';
787787
(my $file = $gl_class) =~ s#::#/#g; require "$file.pm";
788788
print "gdriver: Calling $gl_class(@$options{qw(width height)} @GL_VERSION_NEEDED)\n" if $PDL::Graphics::TriD::verbose;
789-
$this->{_GLObject} = $gl_class->new($options, $this, @GL_VERSION_NEEDED);
790-
$this->{_GLObject}->set_window;
789+
$this->{Impl} = $gl_class->new($options, $this, @GL_VERSION_NEEDED);
790+
$this->{Impl}->set_window;
791791
print "gdriver: Calling glClearColor...\n" if $PDL::Graphics::TriD::verbose;
792792
glClearColor(0,0,0,1);
793793
print "STARTED OPENGL!\n" if $PDL::Graphics::TriD::verbose;
@@ -824,15 +824,15 @@ sub twiddle {
824824
wpic($this->read_picture(),"PDL_$PDL::Graphics::TriD::offlineindex.jpg");
825825
return;
826826
}
827-
return if $getout and $dontshow and !$this->{_GLObject}->event_pending;
827+
return if $getout and $dontshow and !$this->{Impl}->event_pending;
828828
$getout //= !($PDL::Graphics::TriD::keeptwiddling && $PDL::Graphics::TriD::keeptwiddling);
829829
$this->display();
830830
TWIDLOOP: while (1) {
831831
print "EVENT!\n" if $PDL::Graphics::TriD::verbose;
832832
my $hap = 0;
833833
my $gotev = 0;
834-
if ($this->{_GLObject}->event_pending or !$getout) {
835-
@e = $this->{_GLObject}->next_event;
834+
if ($this->{Impl}->event_pending or !$getout) {
835+
@e = $this->{Impl}->next_event;
836836
$gotev=1;
837837
}
838838
print "e= ".join(",",$e[0]//'undef',@e[1..$#e])."\n" if $PDL::Graphics::TriD::verbose;
@@ -868,7 +868,7 @@ sub twiddle {
868868
}
869869
}
870870
}
871-
if (!$this->{_GLObject}->event_pending) {
871+
if (!$this->{Impl}->event_pending) {
872872
$this->display if $hap;
873873
last TWIDLOOP if $getout;
874874
}
@@ -881,7 +881,7 @@ sub twiddle {
881881
sub close {
882882
my ($this, $close_window) = @_;
883883
print "CLOSE\n" if $PDL::Graphics::TriD::verbose;
884-
undef $this->{_GLObject};
884+
undef $this->{Impl};
885885
$PDL::Graphics::TriD::current_window = undef;
886886
}
887887

@@ -892,8 +892,8 @@ use constant TAN => sin(ANGLE)/cos(ANGLE);
892892
use constant fH => TAN * zNEAR;
893893
sub display {
894894
my ($this) = @_;
895-
return if !defined($this) or !defined $this->{_GLObject}; # eg global destroy
896-
$this->{_GLObject}->set_window; # for multiwindow support
895+
return if !defined($this) or !defined $this->{Impl}; # eg global destroy
896+
$this->{Impl}->set_window; # for multiwindow support
897897
print "display: calling glClear()\n" if $PDL::Graphics::TriD::verbose;
898898
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
899899
for my $vp (@{$this->{_ViewPorts}}) {
@@ -927,7 +927,7 @@ sub display {
927927
uNormalMatrix => [ Mat3 => [1, 1, $mv->slice('0:2,0:2')->inv->t->list] ],
928928
});
929929
}
930-
$this->{_GLObject}->swap_buffers;
930+
$this->{Impl}->swap_buffers;
931931
print "display: after SwapBuffers\n" if $PDL::Graphics::TriD::verbose;
932932
}
933933

@@ -1068,7 +1068,7 @@ OO interface to swapping frame buffers
10681068

10691069
sub swap_buffers {
10701070
my ($this) = @_;
1071-
die "swap_buffers: got object with inconsistent _GLObject info\n";
1071+
die "swap_buffers: got object with inconsistent GLObject info\n";
10721072
}
10731073

10741074
=head2 set_window

lib/PDL/Graphics/TriD/Tk.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ sub GLinit{
145145
# print "OW= ",$self->width," OH= ",$self->height,"\n";
146146
# $self->update;
147147
# print "NW= ",$self->width," NH= ",$self->height,"\n";
148-
$self->{GLwin}{_GLObject}->XResizeWindow($self->width ,$self->height);
148+
$self->{GLwin}{Impl}->XResizeWindow($self->width ,$self->height);
149149

150150
$self->{GLwin}->reshape($self->width,$self->height);
151151
$self->refresh();

0 commit comments

Comments
 (0)