fix more tutorials
[sdlgit/SDL_perl.git] / lib / SDL / OpenGL.pm
CommitLineData
7b6a53a1 1#!/usr/bin/env perl
8fde61e3 2#
7b6a53a1 3# OpenGL.pm
8fde61e3 4#
7b6a53a1 5# Copyright (C) 2005 David J. Goehrig <dgoehrig@cpan.org>
6#
7# ------------------------------------------------------------------------------
8#
9# This library is free software; you can redistribute it and/or
10# modify it under the terms of the GNU Lesser General Public
11# License as published by the Free Software Foundation; either
12# version 2.1 of the License, or (at your option) any later version.
13#
14# This library is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17# Lesser General Public License for more details.
18#
19# You should have received a copy of the GNU Lesser General Public
20# License along with this library; if not, write to the Free Software
21# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22#
23# ------------------------------------------------------------------------------
24#
25# Please feel free to send questions, suggestions or improvements to:
26#
27# David J. Goehrig
28# dgoehrig@cpan.org
8fde61e3 29#
30
31package SDL::OpenGL;
32
084b921f 33use strict;
34use warnings;
35use Carp;
36
8fde61e3 37require Exporter;
38require DynaLoader;
39use vars qw(
40 @EXPORT
41 @ISA
42);
43@ISA=qw(Exporter DynaLoader);
44
45use SDL;
8fde61e3 46
084b921f 47
8fde61e3 48bootstrap SDL::OpenGL;
49for ( keys %SDL::OpenGL:: ) {
50 if (/^gl/) {
51 push @EXPORT,$_;
52 }
53}
54
7b6a53a1 55use SDL::OpenGL::Constants;
8fde61e3 56
571;
58
59__END__;
60
61=pod
62
63
64
65=head1 NAME
66
67SDL::OpenGL - a perl extension
68
69=head1 DESCRIPTION
70
71L<SDL::OpenGL> is a perl module which when used by your application
72exports the gl* and glu* functions into your application's primary namespace.
73Most of the functions described in the OpenGL 1.3 specification are currently
74supported in this fashion. As the implementation of the OpenGL bindings that
75comes with SDL_perl is largely type agnositic, there is no need to decline
76the function names in the fashion that is done in the C API. For example,
77glVertex3d is simply glVertex, and perl just does the right thing with regards
78to types.
79
80=head1 CAVEATS
81
82The following methods work different in Perl than in C:
83
84=over 2
85
86=item glCallLists
87
88 glCallLists(@array_of_numbers);
89
90Unlike the C function, which get's passed a count, a type and a list of
91numbers, the Perl equivalent only takes a list of numbers.
92
93Note that this is slow, since it needs to allocate memory and construct a
94list of numbers from the given scalars. For a faster version see
95L<glCallListsString>.
96
97=back
98
99The following methods exist in addition to the normal OpenGL specification:
100
101=over 2
102
103=item glCallListsString
104
105 glCallListsString($string);
106
107Works like L<glCallLists()>, except that it needs only one parameter, a scalar
108holding a string. The string is interpreted as a set of bytes, and each of
109these will be passed to glCallLists as GL_BYTE. This is faster than
110glCallLists, so you might want to pack your data like this:
111
112 my $lists = pack("C", @array_of_numbers);
113
114And later use it like this:
115
116 glCallListsString($lists);
117
118=back
119
120=head1 AUTHOR
121
122David J. Goehrig
123
124=head1 SEE ALSO
125
126L<perl> L<SDL::App>
127
128=cut