in reply to PDL questions

my $winopt = {Device => '/GW', WindowWidth => 7, Aspect => 1};

Afaik, this hashref is specific to PGPLOT, but you've commented out the line that will load PGPLOT - so a strange error is not unexpected. I could be wrong about this, however. As mentioned elsewhere, ask on the PDL list.

The second piece of code you posted will output a nice png file (minus the "close" image) if you set the PGPLOT_DEV environment variable to /PNG. The name of the output file will be pgplot.png - at least that's what happens for me. I don't know offhand what's needed to get rid of that "close" box. If I make progress with any of this later on tonight I'll update this post.

UPDATE: One simple way to avoid the "close" box is to add the line <STDIN>; to the bottom the script.
Then, with the focus returned to the cmd.exe console, hit "Enter" when you're ready to close the graphics window, and the "close" box should appear. Or you could just do a sleep 5; instead. In other words, that "close" box shouldn't pop into existence until the script is about to exit.

... but here:http://sourceforge.net/apps/mediawiki/pdl/index.php?title=Installing_PDL_on_Windows ..

UPDATE: What follows is rubbish - both "cpan.uwinnipeg.ca" and "theoryx5.uwinnipeg.ca" have been around for ages - and it has taken me all this time to notice that. The webpage I mention below as being in need of amendment is fine the way it is.

The information at http://sourceforge.net/apps/mediawiki/pdl/index.php?title=Installing_PDL_on_Windows will need to be updated. There seems to have been a migration from "theoryx5.uwinnipeg.ca" to "cpan.uwinnipeg.ca" - perhaps the migration is still taking place, as the 5.6 and 5.8 repos are still under "theoryx5". I'll update that page when I find out what's going on.

Cheers,
Rob

Replies are listed 'Best First'.
Re^2: PDL questions
by Anonymous Monk on Sep 27, 2010 at 10:59 UTC
    thank you Rob very much for uploading opengl 0.63 , now the examples run more smoothly, and i get rid of from strange hang out sometimes when running the examples using the beautiful 3D PDL::Graphics::TriD module here is an animated mandelbrot i copied from TriDGallery.PM in "C:\Perl\site\lib\PDL\Demos"
    it is displaying an animated color mandel set like this :
    http://img580.imageshack.us/img580/1223/mandel.png
    indeed i have astonished by the versatile and deep features this PDL module has especially with its 2D and 3D features.
    use PDL; use PDL::Graphics::TriD; #Color Mandelbrot animation nokeeptwiddling3d(); $a=zeroes 300,300;$r=$a->xlinvals(-1.5,0.5); $i=$a->ylinvals(-1,1); $t=$r;$u=$i; for(1..30){$q=$r**2-$i**2+$t; $h = 2*$r*$i+$u; $d=$r**2+$i**2; $a=lclip($a,$_*($d>2.0)*($a==0)); ($r,$i) = map{$_->clip(-5,5)}$q,$h; imagrgb[($a==0)*($r/2+0.75),($a==0)*($i+1)/2,$a/30]}; # [press 'q' in the graphics window when done] keeptwiddling3d(); twiddle3d();

    regarding the error "Interface HASH(0X25C224) is not known!" i still get it even if i add
    use PDL;
    use PDL::Graphics2D;
    use PDL::Graphics::PGPLOT::Window;
    use PDL::Graphics::PGPLOT;
    it gives the error at the line

    my $w = PDL::Graphics2D->new($winopt);

    if i use "PDL::Graphics::PGPLOT::Window" instead as the code below i get an error "Undefined subroutine &main::imag2d called at err.pl line 13"
    use PDL; use PDL::Graphics2D; #imports imag2d() and twiddle() use PDL::Graphics::PGPLOT::Window; use PDL::Graphics::PGPLOT; my $winopt = {Device => "/GW", WindowWidth => 7, Aspect => 1}; #my $w = PDL::Graphics2D->new($winopt); my $w = PDL::Graphics::PGPLOT::Window->new($winopt); $a = sequence(64,48,3); # make test RGB image $a = $a->mv(2,0); # color must be dim(0) with size [0..4] $a /= $a->max; # pixel values in [0.0,1.0] $a = sin(10*$a); $w = imag2d($a);


    it can be an ms windows specific problem, sure the developer get it working since the example is here :
    http://kobesearch.cpan.org/htdocs/PDL/PDL/Graphics2D.html
    so i will post to the pdl forum

    thank you Rob for all your efforts.
      i have tried the above error examples on linux mint, just changing the device to /xs instead of /GW:
      my $winopt = {Device => "/xs", WindowWidth => 7, Aspect => 1};

      and i got the same errors, the first one is
      Interface HASH(0X9F05818) is not known!
      regards

        Again, you're passing $winopt as the first parameter. $winopt is a hash reference, but PDL::Graphics2D wants an "Interface" (whatever it means by this) as the first parameter, and it tells you that it is unhappy with a hash reference. See the PDL::Graphics2D documentation.

        $win = PDL::Graphics2D->new(<Interface>, <Options>);

        Looking inside, there is currently only one "interface" defined: 'PGPLOT'. So try passing that as the first argument to new().

        i have found some solution, inspired by many posts especially a message with a title "imag2d.pdl for test" :
        http://mailman.jach.hawaii.edu/pipermail/perldl/2009-December/002665.html and
        http://mailman.jach.hawaii.edu/pipermail/perldl/2010-January/002716.html
        we need a file "imag2d.pdl" not in the pdl package, and to use PDL::AutoLoader, as explained in the above message so putting the file imag2d.pdl in the same folder as the following code can run successfully the code with a red dusk like image. i run the code in windows xp activestate perl 5.10
        use PDL; use PGPLOT; use PDL::Graphics2D; #imports imag2d() and twiddle() use PDL::AutoLoader; our @PDLLIB; push @PDLLIB, '.'; my $winopt = {Device => '/GW', WindowWidth => 7, Aspect => 1}; my $w = PDL::Graphics2D->new('PGPLOT'); $a = sequence(64,48,3); # make test RGB image $a = $a->mv(2,0); # color must be dim(0) with size [0..4] $a /= $a->max; # pixel values in [0.0,1.0] $a = sin(10*$a); imag2d($a);

        there may be more improvements, thanks for all
        thank you BrowserUk, as always you supply a clear specific answer for the non prof users. i have applied your suggestion
        my $w = PDL::Graphics2D->new('PGPLOT');
        and added also use PGPLOT;
        and yes i can run all the code and display a window like this
        http://img409.imageshack.us/img409/1384/erroriu.png
        but with an error at the final line
        "Can't locate object method "imag2d" via package "PDL" at err.pl line 13"
        this is the same using windows xp and linux mint
        i choose linux mint because it is super easy to install modules directly from their site. and indeed it is the first time i am using linux. also i want to thank zentara for the second version of the "PDL 3d image cube" example in www.perlmonks.org/?node_id=591731
        it is working well rotate and zoom in and out with the mouse.
        regards