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 72 73 74 75 76 77 78 79 80
|
package Gtk::GLArea::Constants;
require Gtk;
require Exporter;
require AutoLoader;
use Carp;
@ISA = qw(Exporter AutoLoader);
# Items to export into callers namespace by default. Note: do not export
# names by default without a very good reason. Use EXPORT_OK instead.
# Do not simply export all your public functions/methods/constants.
@EXPORT = qw(
GDK_GL_NONE
GDK_GL_USE_GL
GDK_GL_BUFFER_SIZE
GDK_GL_LEVEL
GDK_GL_RGBA
GDK_GL_DOUBLEBUFFER
GDK_GL_STEREO
GDK_GL_AUX_BUFFERS
GDK_GL_RED_SIZE
GDK_GL_GREEN_SIZE
GDK_GL_BLUE_SIZE
GDK_GL_ALPHA_SIZE
GDK_GL_DEPTH_SIZE
GDK_GL_STENCIL_SIZE
GDK_GL_ACCUM_RED_SIZE
GDK_GL_ACCUM_GREEN_SIZE
GDK_GL_ACCUM_BLUE_SIZE
GDK_GL_ACCUM_ALPHA_SIZE
GDK_GL_X_VISUAL_TYPE_EXT
GDK_GL_TRANSPARENT_TYPE_EXT
GDK_GL_INDEX_VALUE_EXT
GDK_GL_RED_VALUE_EXT
GDK_GL_GREEN_VALUE_EXT
GDK_GL_BLUE_VALUE_EXT
GDK_GL_ALPHA_VALUE_EXT
);
# Other items we are prepared to export if requested
@EXPORT_OK = qw();
sub AUTOLOAD {
# This AUTOLOAD is used to 'autoload' constants from the constant()
# XS function. If a constant is not found then control is passed
# to the AUTOLOAD in AutoLoader.
# NOTE: THIS AUTOLOAD FUNCTION IS FLAWED (but is the best we can do for now).
# Avoid old-style ``&CONST'' usage. Either remove the ``&'' or add ``()''.
if (@_ > 0) {
$AutoLoader::AUTOLOAD = $AUTOLOAD;
goto &AutoLoader::AUTOLOAD;
}
local($constname);
($constname = $AUTOLOAD) =~ s/.*:://;
$val = constant($constname, @_ ? $_[0] : 0);
if (not defined $val) {
if ($! =~ /Invalid/) {
$AutoLoader::AUTOLOAD = $AUTOLOAD;
goto &AutoLoader::AUTOLOAD;
}
else {
($pack,$file,$line) = caller;
die "Your vendor has not defined GL macro $constname, used at $file line $line.
";
}
}
eval "sub $AUTOLOAD { $val }";
goto &$AUTOLOAD;
}
1;
__END__
|