line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OpenGL::Earth::Render; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
38282
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
47
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
5
|
1
|
|
|
1
|
|
1925
|
use OpenGL q(:all); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub string { |
8
|
|
|
|
|
|
|
my ( $font, $str ) = @_; |
9
|
|
|
|
|
|
|
my @c = split '', $str; |
10
|
|
|
|
|
|
|
for (@c) { |
11
|
|
|
|
|
|
|
glutBitmapCharacter( $font, ord $_ ); |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub text_stats { |
16
|
|
|
|
|
|
|
my ($motion) = @_; |
17
|
|
|
|
|
|
|
my ($width, $height) = ( 600, 600 ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# We need to change the projection matrix for the text rendering. |
20
|
|
|
|
|
|
|
glMatrixMode(GL_PROJECTION); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# But we like our current view too; so we save it here. |
23
|
|
|
|
|
|
|
glPushMatrix(); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Now we set up a new projection for the text. |
26
|
|
|
|
|
|
|
glLoadIdentity(); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
glOrtho( 0, $width, 0, $height, -1.0, 1.0 ); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Lit or textured text looks awful. |
31
|
|
|
|
|
|
|
glDisable(GL_TEXTURE_2D); |
32
|
|
|
|
|
|
|
glDisable(GL_TEXTURE_GEN_S); |
33
|
|
|
|
|
|
|
glDisable(GL_TEXTURE_GEN_T); |
34
|
|
|
|
|
|
|
glDisable(GL_LIGHTING); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# We don'$t want depth-testing either. |
37
|
|
|
|
|
|
|
glDisable(GL_DEPTH_TEST); |
38
|
|
|
|
|
|
|
glColor4f( 0.6, 1.0, 0.6, .75 ); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Render our various display mode settings. |
41
|
|
|
|
|
|
|
my $buf; |
42
|
|
|
|
|
|
|
$buf = sprintf "Mode: %s", $OpenGL::Earth::TEXTURE_MODE; |
43
|
|
|
|
|
|
|
glRasterPos2i( 2, 2 ); |
44
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$buf = sprintf "AAdd: %d", $OpenGL::Earth::ALPHA_ADD; |
47
|
|
|
|
|
|
|
glRasterPos2i( 2, 14 ); |
48
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$buf = sprintf "Blend: %d", $OpenGL::Earth::BLEND_ON; |
51
|
|
|
|
|
|
|
glRasterPos2i( 2, 26 ); |
52
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
$buf = sprintf "Light: %d", $OpenGL::Earth::LIGHT_ON; |
55
|
|
|
|
|
|
|
glRasterPos2i( 2, 38 ); |
56
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
$buf = sprintf "Tex: %d", $OpenGL::Earth::TEXTURE_ON; |
59
|
|
|
|
|
|
|
glRasterPos2i( 2, 50 ); |
60
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$buf = sprintf "Filt: %d", $OpenGL::Earth::FILTERING_ON; |
63
|
|
|
|
|
|
|
glRasterPos2i( 2, 62 ); |
64
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
$buf = sprintf "XAcc: %3.3f", $motion->{force_x}; |
67
|
|
|
|
|
|
|
glRasterPos2i( 2, 74 ); |
68
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
$buf = sprintf "YAcc: %3.3f", $motion->{force_y}; |
71
|
|
|
|
|
|
|
glRasterPos2i( 2, 88 ); |
72
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$buf = sprintf "ZAcc: %3.3f", $motion->{force_z}; |
75
|
|
|
|
|
|
|
glRasterPos2i( 2, 100 ); |
76
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
$buf = sprintf "XTilt: %3.3f", $motion->{tilt_x}; |
79
|
|
|
|
|
|
|
glRasterPos2i( 2, 114 ); |
80
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
$buf = sprintf "YTilt: %3.3f", $motion->{tilt_y}; |
83
|
|
|
|
|
|
|
glRasterPos2i( 2, 128 ); |
84
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
$buf = sprintf "Pitch: %3.3f", $motion->{tilt_z}; |
87
|
|
|
|
|
|
|
glRasterPos2i( 2, 142 ); |
88
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
$buf = sprintf "XAxis: %3.3f", $motion->{axis_x}; |
91
|
|
|
|
|
|
|
glRasterPos2i( 2, 156 ); |
92
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
$buf = sprintf "YAxis: %3.3f", $motion->{axis_y}; |
95
|
|
|
|
|
|
|
glRasterPos2i( 2, 170 ); |
96
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
$buf = sprintf "ZAxis: %3.3f", $motion->{axis_z}; |
99
|
|
|
|
|
|
|
glRasterPos2i( 2, 184 ); |
100
|
|
|
|
|
|
|
string( GLUT_BITMAP_HELVETICA_12, $buf ); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
# Now we want to render the calulated FPS at the top. |
103
|
|
|
|
|
|
|
# To ease, simply translate up. Note we're working in screen |
104
|
|
|
|
|
|
|
# pixels in this projection. |
105
|
|
|
|
|
|
|
# |
106
|
|
|
|
|
|
|
#glTranslatef(6.0,$Window_Height - 14,0.0); |
107
|
|
|
|
|
|
|
# |
108
|
|
|
|
|
|
|
# Make sure we can read the FPS section by first placing a |
109
|
|
|
|
|
|
|
# dark, mostly opaque backdrop rectangle. |
110
|
|
|
|
|
|
|
#glColor4f(0.0, 0.0, 0.0, 0.75); |
111
|
|
|
|
|
|
|
# |
112
|
|
|
|
|
|
|
#glBegin(GL_QUADS); |
113
|
|
|
|
|
|
|
#glVertex3f( 0.0, -2.0, 0.0); |
114
|
|
|
|
|
|
|
#glVertex3f( 0.0, 12.0, 0.0); |
115
|
|
|
|
|
|
|
#glVertex3f(140.0, 12.0, 0.0); |
116
|
|
|
|
|
|
|
#glVertex3f(140.0, -2.0, 0.0); |
117
|
|
|
|
|
|
|
#glEnd(); |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
#glColor4f(0.9, 0.0, 0.0, .75); |
120
|
|
|
|
|
|
|
#$buf = sprintf "FPS: %f F: %2d", $FrameRate, $FrameCount; |
121
|
|
|
|
|
|
|
#glRasterPos2i(6,0); |
122
|
|
|
|
|
|
|
#string(GLUT_BITMAP_HELVETICA_12,$buf); |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# Done with this special projection matrix. Throw it away. |
125
|
|
|
|
|
|
|
glPopMatrix(); |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
1; |