line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenGL::List; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
OpenGL::List - Massively optimise your Perl OpenGL program with display lists |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 DESCRIPTION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head FUNCTIONS |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=cut |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
1082
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
36
|
|
16
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
17
|
1
|
|
|
1
|
|
16
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
18
|
1
|
|
|
1
|
|
702
|
use OpenGL (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=pod |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 glpList |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $list_name = glpList { |
27
|
|
|
|
|
|
|
glBegin( GL_LINES ); |
28
|
|
|
|
|
|
|
glVertex3f( 0, 0, 0 ); |
29
|
|
|
|
|
|
|
glVertex3f( 1, 0, 0 ); |
30
|
|
|
|
|
|
|
glVertex3f( 0, 0, 0 ); |
31
|
|
|
|
|
|
|
glVertex3f( 0, 1, 0 ); |
32
|
|
|
|
|
|
|
glVertex3f( 0, 0, 0 ); |
33
|
|
|
|
|
|
|
glVertex3f( 0, 0, 1 ); |
34
|
|
|
|
|
|
|
glEnd(); |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
The glpLine function is used to define a block of Perl OpenGL instructions that |
38
|
|
|
|
|
|
|
should be immediately compiled into a display list. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Returns a new display list name that can be passed to glCallList() later. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub glpList(&) { |
45
|
|
|
|
|
|
|
my $code = shift; |
46
|
|
|
|
|
|
|
my $id = OpenGL::glGenLists(1); |
47
|
|
|
|
|
|
|
OpenGL::glNewList( $id, OpenGL::GL_COMPILE() ); |
48
|
|
|
|
|
|
|
$code->(); |
49
|
|
|
|
|
|
|
OpenGL::glEndList(); |
50
|
|
|
|
|
|
|
return $id; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=pod |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 SUPPORT |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Bugs should be reported via the CPAN bug tracker at |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
L |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 AUTHOR |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Adam Kennedy Eadamk@cpan.orgE |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SEE ALSO |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
L |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 COPYRIGHT |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Copyright 2010 Adam Kennedy. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This program is free software; you can redistribute |
76
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
The full text of the license can be found in the |
79
|
|
|
|
|
|
|
LICENSE file included with this module. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |