Applied patch to allow fast App init
[sdlgit/SDL_perl.git] / lib / SDL / OpenGL.pm
CommitLineData
8fde61e3 1# SDL::OpenGL.pm
2#
3# A simplified OpenGL wrapper
4#
5# Copyright (C) 2002, 2003, 2004 David J. Goehrig
6#
7
8package SDL::OpenGL;
9
10require Exporter;
11require DynaLoader;
12use vars qw(
13 @EXPORT
14 @ISA
15);
16@ISA=qw(Exporter DynaLoader);
17
18use SDL;
19use SDL::OpenGL::Constants;
20
21bootstrap SDL::OpenGL;
22for ( keys %SDL::OpenGL:: ) {
23 if (/^gl/) {
24 push @EXPORT,$_;
25 }
26}
27
28# export all GL constants
29for (@SDL::OpenGL::Constants::EXPORT) {
30 push @EXPORT, $_;
31}
32
33
341;
35
36__END__;
37
38=pod
39
40
41
42=head1 NAME
43
44SDL::OpenGL - a perl extension
45
46=head1 DESCRIPTION
47
48L<SDL::OpenGL> is a perl module which when used by your application
49exports the gl* and glu* functions into your application's primary namespace.
50Most of the functions described in the OpenGL 1.3 specification are currently
51supported in this fashion. As the implementation of the OpenGL bindings that
52comes with SDL_perl is largely type agnositic, there is no need to decline
53the function names in the fashion that is done in the C API. For example,
54glVertex3d is simply glVertex, and perl just does the right thing with regards
55to types.
56
57=head1 CAVEATS
58
59The following methods work different in Perl than in C:
60
61=over 2
62
63=item glCallLists
64
65 glCallLists(@array_of_numbers);
66
67Unlike the C function, which get's passed a count, a type and a list of
68numbers, the Perl equivalent only takes a list of numbers.
69
70Note that this is slow, since it needs to allocate memory and construct a
71list of numbers from the given scalars. For a faster version see
72L<glCallListsString>.
73
74=back
75
76The following methods exist in addition to the normal OpenGL specification:
77
78=over 2
79
80=item glCallListsString
81
82 glCallListsString($string);
83
84Works like L<glCallLists()>, except that it needs only one parameter, a scalar
85holding a string. The string is interpreted as a set of bytes, and each of
86these will be passed to glCallLists as GL_BYTE. This is faster than
87glCallLists, so you might want to pack your data like this:
88
89 my $lists = pack("C", @array_of_numbers);
90
91And later use it like this:
92
93 glCallListsString($lists);
94
95=back
96
97=head1 AUTHOR
98
99David J. Goehrig
100
101=head1 SEE ALSO
102
103L<perl> L<SDL::App>
104
105=cut