Hey folks -

This morning I've been hacking at getting PLplot and OpenGL to play
together.  The first step for me is to get PLplot and imag2d to work
together, and I've finally got it.  Below is an example script that should
work as long as you have PDL::Graphics::PLplot installed and you have put
imag2d.pdl in your current directory.

David



#!/usr/bin/perl

use strict;
use warnings;
use PDL;

# By definition, you need PLplot installed:
use PDL::Graphics::PLplot;

# Also, this only works if you've put imag2d in your current
# directory.  You can download imag2d from
#
http://pdl.git.sourceforge.net/git/gitweb.cgi?p=pdl/pdl;a=blob_plain;f=imag2d.pdl;hb=HEAD

use PDL::AutoLoader;
our @PDLLIB;
push @PDLLIB, '.';

# Enought loading; here's...
# ======= The Script! =======

# First allocate the memory for the plotting.  PLplot will
# simply draw black (value of 0) over our piddle, so initialize
# it to 'white', i.e. 255:
my $memory = zeroes(byte, 3, 400, 400) + 255;
my $pl = new PDL::Graphics::PLplot(DEV => 'mem', MEM => $memory);

# Plot some data - a parabola
my $t = sequence(101) - 50;
my $x = $t**2;
$pl->xyplot($t, $x);

# And send the plot to imag2d:
imag2d($memory);
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to