1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
# -*-perl-*-
BEGIN{
# Set perl to not try to resolve all symbols at startup
# The default behavior causes some problems because
# opengl.pd builds an interface for all functions
# defined in gl.h and glu.h even though they might not
# actually be in the opengl libraries.
$ENV{'PERL_DL_NONLAZY'}=0;
}
# use PDL::Graphics::OpenGL;
sub hasDISPLAY {
return defined $ENV{DISPLAY} && $ENV{DISPLAY} !~ /^\s*$/;
}
use Test::More;
BEGIN {
use PDL::Config;
if ( $PDL::Config{USE_POGL} ) {
if ( hasDISPLAY or exists($ENV{'PDL_INT'}) ) {
plan tests => 4;
use_ok("OpenGL $PDL::Config{POGL_VERSION}", qw(:all));
use_ok('PDL::Graphics::OpenGL::Perl::OpenGL');
} else { # no DISPLAY
plan tests => 2;
use_ok("OpenGL $PDL::Config{POGL_VERSION}", qw(:all));
use_ok('PDL::Graphics::OpenGL::Perl::OpenGL');
exit;
}
} else {
if( $PDL::Config{OPENGL_LIBS} && $PDL::Config{WITH_3D}
# only if GL modules have actually been built
&& $PDL::Config{GL_BUILD} && hasDISPLAY()) {
plan tests => 3;
use_ok('PDL::Graphics::OpenGL');
}else{
plan skip_all => ( hasDISPLAY()
? "ok 1 # Skipped: OpenGL support not compiled\n"
: "ok 1 # Skipped: DISPLAY environment variable not set\n" );
exit;
}
}
}
#
# Try opening 2 GL windows
#
SKIP: {
if ( hasDISPLAY and OpenGL::_have_glx ) {
eval { OpenGL::glpDisplay($ENV{DISPLAY}) };
skip "can't open X display", 2 if $@;
}
my $numwins = 2;
my @windows;
my $opt;
$opt->{width} = 90;
$opt->{height} = 90;
foreach(0..$numwins-1){
$opt->{x} = ($numwins % 10) *100;
$opt->{y} = int($numwins / 10) *100;
my $win=new PDL::Graphics::OpenGL::OO($opt);
isa_ok($win, 'PDL::Graphics::OpenGL::OO');
push @windows, $win;
}
}
|