On Mon, 30 Jan 2012 11:41:39 -0500 Chris Marshall <[email protected]> wrote:
>The Tk interface was a unix-only hack.
>You can always revert to PDL-2.4.3 which still
>used the unix-only build but you'll lose a lot
>inevery other way.
>
>Cheers,
>Chris
Hey, good news. Just for the heck of it, I took the
PDL::Graphics::TriD::Tk.pm module from the 2.4.3
and tried to run it under 2.4.009( latest developers).
It worked with 1 change and one warning.
In Tk.pm Change:
#use PDL::Graphics::OpenGL;
to
use PDL::Graphics::OpenGLQ;
then quote the word ExposureMask on line 166
$options->{mask} = ( 'ExposureMask' );
It runs fine, but with a warning:
Argument "ExposureMask" isn't numeric in subroutine entry
at
/home/zentara/perl5/lib/perl5/x86_64-linux-thread-multi/PDL/Graphics/OpenGL/Perl/OpenGL.pm
line 162.
This is the code I ran. The modified Tk.pm is attached.
#!/usr/bin/perl
use warnings;
use Tk;
use PDL::LiteF;
use PDL::Graphics::TriD;
# I put the modified Tk.pm in a local subdirectory
use lib '.';
use PDL::Graphics::TriD::Tk;
my $MW = MainWindow->new();
my $TriDW = $MW->Tk( )->pack(-expand=>1, -fill=>'both');
# needed to make sur GL window sets up
$TriDW->waitVisibility;
&Torusdemos();
my $button = $MW->Button(-text=>'Quit',
-command => sub{ exit })->pack();
$TriDW->MainLoop;
sub Torusdemos {
my $graph;
$graph = $TriDW->{ GLwin }->current_viewport->graph();
$graph = new PDL::Graphics::TriD::Graph();
$graph->default_axes();
# $graph->delete_data( "TorusColors" );
# $graph->delete_data( "TorusLighting" );
my $data;
my $s = 40;
my $a = zeroes 2 * $s, $s / 2;
my $t = $a->xlinvals( 0, 6.284 );
my $u = $a->ylinvals( 0, 6.284 );
my $o = 0.5;
my $i = 0.1;
my $v = $o + $i * sin $u;
my $x = $v * sin $t;
my $y = $v * cos $t;
my $z = $i * cos( $u ) + $o * sin( 3 * $t );
# color
$data = new PDL::Graphics::TriD::SLattice(
[ $x, $y, $z ],
[
0.5 * ( 1 + sin $t ),
0.5 * ( 1 + cos $t ),
0.25 * ( 2 + cos( $u ) + sin( 3 * $t ) )
]
);
# black and white
# $data = new PDL::Graphics::TriD::SLattice_S( [ $x, $y, $z ] );
$graph->add_dataseries( $data, "demo" );
$graph->scalethings();
# $TriDW->current_viewport()->delete_graph( $graph );
$TriDW->current_viewport()->graph( $graph );
$TriDW->refresh();
}
__END__
Tk.pm
Description: Perl program
_______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
