#!/usr/bin/perl -w
use warnings ;
use strict ;
use lib ('blib') ;
use Tk ;
# OpenGL: need r:all for glGetIntegerv_p, need :old for glpOpen Window
use OpenGL qw(:all :old) ;
my $arg = shift ;
my $MW = new MainWindow ;
# craps out if $border = 0
my $border = 1 ;
my ( $w, $h ) = ( 100, 100 ) ;
my $glwin ;
my @attributes = [ GLX_RGBA, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 1 ] ;
my $id = $MW->WindowId ;
my $depth = glGetIntegerv_p( GL_DEPTH_BITS ) ;
print "Depth Before = $depth\n" ;
$glwin = glpOpenWindow
(
x => $border, y => $border,
width => $w, height => $h,
parent => $$id
) if $arg eq 'A' ;
$glwin = glpOpenWindow
(
x => $border, y => $border,
width => $w, height => $h,
parent => $$id,
attributes => \@attributes
) if $arg eq 'B' ;
$glwin = glpcOpenWindow
(
$border, $border,
$w, $h,
$$id,
0,
\@attributes
) if $arg eq 'C' ;
$depth = glGetIntegerv_p( GL_DEPTH_BITS ) ;
print "Depth After = $depth\n" ;
####
Depth Before = 2
Depth After = 0
####
Depth Before = 2
Not a valid parameter to glpOpenWindow: `attributes'
No visual! at /usr/lib/perl5/OpenGL.pm line 6049.
####
Depth Before = 2
X Error of failed request: BadValue (integer parameter out of range for operation)
Major opcode of failed request: 1 (X_CreateWindow)
Value in failed request: 0x2b1af80
Serial number of failed request: 26
Current serial number in output stream: 28