OpenGL.pm (PDL-2.077) | : | OpenGL.pm (PDL-2.078) | ||
---|---|---|---|---|
skipping to change at line 334 | skipping to change at line 334 | |||
=head2 XPending() | =head2 XPending() | |||
OO interface to XPending | OO interface to XPending | |||
=cut | =cut | |||
sub XPending { | sub XPending { | |||
my($self) = @_; | my($self) = @_; | |||
if ( $self->{window_type} eq 'glut' ) { | if ( $self->{window_type} eq 'glut' ) { | |||
# monitor state of @fakeXEvents, return number on queue | # monitor state of @fakeXEvents, return number on queue | |||
OpenGL::GLUT::glutMainLoopEvent() if !@{$self->{xevents}}; | ||||
print STDERR "OO::XPending: have " . scalar( @{$self->{xevents}} ) . " xe vents\n" if $PDL::Graphics::TriD::verbose > 1; | print STDERR "OO::XPending: have " . scalar( @{$self->{xevents}} ) . " xe vents\n" if $PDL::Graphics::TriD::verbose > 1; | |||
scalar( @{$self->{xevents}} ); | scalar( @{$self->{xevents}} ); | |||
} else { | } else { | |||
OpenGL::XPending($self->{Display}); | OpenGL::XPending($self->{Display}); | |||
} | } | |||
} | } | |||
=head2 XResizeWindow | =head2 XResizeWindow | |||
OO interface to XResizeWindow | OO interface to XResizeWindow | |||
skipping to change at line 382 | skipping to change at line 383 | |||
return OpenGL::glpXNextEvent($self->{Display}); | return OpenGL::glpXNextEvent($self->{Display}); | |||
} | } | |||
} | } | |||
=head2 glpRasterFont() | =head2 glpRasterFont() | |||
OO interface to the glpRasterFont function | OO interface to the glpRasterFont function | |||
=cut | =cut | |||
sub glpRasterFont{ | sub glpRasterFont { | |||
my($this,@args) = @_; | my($this,@args) = @_; | |||
OpenGL::glpRasterFont($args[0],$args[1],$args[2],$this->{Display}); | if ( $this->{window_type} eq 'glut' ) { | |||
print STDERR "gdriver: window_type => 'glut' so not actually setting the ra | ||||
sterfont\n" if $PDL::Graphics::TriD::verbose; | ||||
return eval { OpenGL::GLUT_BITMAP_8_BY_13() }; | ||||
} else { | ||||
# NOTE: glpRasterFont() will die() if the requested font cannot be found | ||||
# The new POGL+GLUT TriD implementation uses the builtin GLUT defined | ||||
# fonts and does not have this failure mode. | ||||
my $lb = eval { OpenGL::glpRasterFont(@args[0..2],$this->{Display}) }; | ||||
if ( $@ ) { | ||||
die "glpRasterFont: unable to load font '%s', please set PDL_3D_FONT to | ||||
an existing X11 font."; | ||||
} | ||||
return $lb; | ||||
} | ||||
} | ||||
=head2 swap_buffers | ||||
OO interface to swapping display buffers | ||||
=cut | ||||
sub swap_buffers { | ||||
my ($this) = @_; | ||||
if ( $this->{window_type} eq 'glut' ) { | ||||
OpenGL::GLUT::glutSwapBuffers(); | ||||
} elsif ( $this->{window_type} eq 'x11' ) { | ||||
$this->glXSwapBuffers(); | ||||
} else { | ||||
die "swap_buffers: got object with inconsistent _GLObject info\n"; | ||||
} | ||||
} | ||||
=head2 set_window | ||||
OO interface to setting the display window (if appropriate) | ||||
=cut | ||||
sub set_window { | ||||
my ($this) = @_; | ||||
return if $this->{window_type} ne 'glut'; | ||||
# set GLUT context to current window (for multiwindow support) | ||||
OpenGL::GLUT::glutSetWindow($this->{glutwindow}); | ||||
} | } | |||
=head2 AUTOLOAD | =head2 AUTOLOAD | |||
If the function is not prototyped in OO we assume there is | If the function is not prototyped in OO we assume there is | |||
no explicit mention of the three identifying parameters (Display, Window, Contex t) | no explicit mention of the three identifying parameters (Display, Window, Contex t) | |||
and try to load the OpenGL function. | and try to load the OpenGL function. | |||
=cut | =cut | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 48 lines changed or added |