package OpenGL;

$Version = 0.4;

# file OpenGL.pm is generated by OpenGL.pm.gen 
#EVAL: sub forfile{local($file,$s)=@_;$out = "";open(FILE,$file) || die "cant open $file";while(<FILE>) {$out .=&$s($_);}close(FILE);$out;};""

require Exporter;
require DynaLoader;

@ISA = qw(Exporter DynaLoader);
@EXPORT = qw(
	glpOpenWindow
	glXSwapBuffers 
	XPending
	glpXNextEvent
	glpXQueryPointer

	glpReadTex

	glpClipPlane
	glpGetClipPlane
	glpLoadMatrixf glpLoadMatrixd glpMultMatrixf glpMultMatrixd

	gluOrtho2D
	gluPerspective
	gluLookAt

#EVAL: forfile("/usr/include/GL/gl.h",sub {($_[0]=~/extern\s+(\w+)\s+(\w+)\s*\((.*)\)\s*\;/)?"\t$2\n":"";})

#EVAL: $gc=sub{($_[0]=/\#define\s+(\S+)\s+(\S+)/)?"\t$1\n":"";} ;""
#EVAL: forfile("X.h",$gc)

#EVAL: forfile("/usr/include/GL/gl.h",$gc)

#EVAL: forfile("/usr/include/GL/glxtokens.h",$gc)

#EVAL: forfile("/usr/include/GL/glu.h",$gc)

);
bootstrap OpenGL;

#EVAL: $dc=sub{($_[0]=/\#define\s+(\S+)\s+(\S+)/)?"sub $1 {$2;}\n":"";} ;""
# from X.h
#EVAL: forfile("X.h",$dc)

#EVAL: forfile("/usr/include/GL/gl.h",$dc)

#EVAL: forfile("/usr/include/GL/glxtokens.h",$dc)

#EVAL: forfile("/usr/include/GL/glu.h",$dc)

%window_defaults=(
		'x'	=> 0,
		'y'	=> 0,
		'width'	=> 500,
		'height'=> 500,
		'parent'=> 0,
		'mask'	=> StructureNotifyMask,
		'attributes'=> [GLX_RGBA],
	);
sub glpOpenWindow {
	# default values
	my(%a) = @_;
	my(%p) = %window_defaults;
	foreach $k (keys(%a)){
		defined($p{$k}) || warn "Not a valid parameter to glpOpenWindow: `$k'\n";
		#print "parameter $k now ",$a{$k}," was ",$p{$k},"\n";  
		$p{$k} = $a{$k};
	}
	glpcOpenWindow($p{x},$p{y},$p{width},$p{height},
	               $p{parent},$p{'mask'},
	               @{$p{attributes}});
}


1;
__END__
