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