/usr/share/doc/libopengl-perl/examples/glu_test.pl is in libopengl-perl 0.6704+dfsg-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | #!/usr/bin/perl
#
# glu_test
#
# same as cube but uses a glu function to test
# that glu stuff is working
#
BEGIN{ unshift(@INC,"../blib"); } # in case OpenGL is built but not installed
BEGIN{ unshift(@INC,"../blib/arch"); } # 5.002 gamma needs this
BEGIN{ unshift(@INC,"../blib/lib"); } # 5.002 gamma needs this
use OpenGL;
sub wirecube{
# adapted from libaux
local($s) = @_;
local(@x,@y,@z,@f);
local($i,$j,$k);
$s = $s/2.0;
@x=(-$s,-$s,-$s,-$s,$s,$s,$s,$s);
@y=(-$s,-$s,$s,$s,-$s,-$s,$s,$s);
@z=(-$s,$s,$s,-$s,-$s,$s,$s,-$s);
@f=(
0, 1, 2, 3,
3, 2, 6, 7,
7, 6, 5, 4,
4, 5, 1, 0,
5, 6, 2, 1,
7, 4, 0, 3,
);
for($i=0;$i<6;$i++){
glBegin(GL_LINE_LOOP);
for($j=0;$j<4;$j++){
$k=$f[$i*4+$j];
glVertex3d($x[$k],$y[$k],$z[$k]);
}
glEnd();
}
}
sub display{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0, 1.0);
glLoadIdentity(); # clear the matrix
glTranslatef(0.0, 0.0, -5.0); # viewing transformation
glScalef(1.0, 2.0, 1.0); # modeling transformation
wirecube(1.0);
glpFlush();
}
sub myReshape {
# glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
# using gluPerspective instead of glFrustum to test glu library
#glFrustum(-1.0, 1.0, -1.0, 1.0, 1.5, 20.0);
gluPerspective(30.0,1.0,1.0,30.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity ();
}
glpOpenWindow;
glShadeModel(GL_FLAT);
myReshape();
display();
glpMainLoop;
|