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