Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

hello
if i run the following code i get error message:
Interface HASH(0X25C224) is not known!
on windows xp activeperl 5.10

use PDL; use PDL::Graphics2D; #imports imag2d() and twiddle() #use PDL::Graphics::PGPLOT::Window; my $winopt = {Device => '/GW', WindowWidth => 7, Aspect => 1}; my $w = PDL::Graphics2D->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);

is this just special to windows os. i know imag2d is new, also PDL::Graphics2D

second question:
running any example such as the following one from the pdl book http://www.johnlapeyre.com/pdl/pdldoc/newbook/node6.html produce a nagging "close" small window above the draw window such as in this beautiful arrow image:
http://img716.imageshack.us/img716/3179/pdl.png
how to get rid from it
use PDL; use PDL::Graphics::PGPLOT; #my $win1 = dev('/GW', {Aspect => 1, WindowWidth => 7}); $x = xlinvals(zeroes(100,100), -5, 5); $y = ylinvals(zeroes(100,100), -5, 5); $z = sin($x*$y/2); imag $z; hold; #Show the partial derivatives wrt. x & y as vectors $xcomp = $x*cos($x*$y/2)/2; $ycomp = $y*cos($x*$y/2)/2; #We want to show only every sixth vector for clarity $s = '0:-1:10,0:-1:10'; #Finally we need to map the final 10x10 array to the 100x100 image $tr = pdl(0,10,0,0,0,10); vect $xcomp->slice($s), $ycomp->slice($s), {Transform=>$tr};
on the other hand the site http://cpan.uwinnipeg.ca/PPMPackages/10xx/contains opengl v 0.62 and PDL 2.4.7 while here http://www.perlmonks.org/?node=PDL-2.4.7+released syphilis said that it requires v. 0.63 . so i have downloaded it from http://www.bribes.org/perl/ppmdir.html
but here:http://sourceforge.net/apps/mediawiki/pdl/index.php?title=Installing_PDL_on_Windows it is said that PDL packages expect a static freeglut library and not a dynamic freeglut library .
thanks for any help

Replies are listed 'Best First'.
Re: PDL questions
by moritz (Cardinal) on Sep 26, 2010 at 12:05 UTC
    Interface HASH(0X25C224) is not known!

    The first argument to PDL::Graphics2D->new should be an Interface. I don't know enough PDL to know what that means exactly, but obviously a hash ref isn't a valid interface.

    Perl 6 - links to (nearly) everything that is Perl 6.
Re: PDL questions
by zentara (Cardinal) on Sep 26, 2010 at 17:09 UTC
Re: PDL questions
by syphilis (Archbishop) on Sep 27, 2010 at 07:32 UTC
    ... PDL packages expect a static freeglut library and not a dynamic freeglut library

    Yes, best to use a statically built OpenGL-0.63 with the PDL packages from Uwinnipeg.

    Sorry, I thought I had uploaded OpenGL-0.63 for perl 5.10 to the uwinnipeg rep - but you're right, it's still at 0.62. I'm uploading 0.63 as I type - and I'll update this post when it's all done. (Might take 30 minutes or so to get it uploaded, and then check that it's right.)

    Cheers,
    Rob

    UPDATE: Right - should be ok now, see how you go. The webpage still reports the version as 0.62, but running:
    ppm install http://cpan.uwinnipeg.ca/PPMPackages/10xx/OpenGL.ppd
    will give you version 0.63. The webpage will be corrected.
Re: PDL questions
by syphilis (Archbishop) on Sep 27, 2010 at 08:36 UTC
    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
      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