File: simple.pl

package info (click to toggle)
libopengl-perl 0.6704%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,988 kB
  • ctags: 1,979
  • sloc: perl: 10,008; ansic: 5,935; makefile: 101; sh: 51
file content (26 lines) | stat: -rw-r--r-- 651 bytes parent folder | download | duplicates (5)
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
#!/usr/local/bin/perl
#
# simple example taken from listing 1-1 (or 1-2) from OpenGL book
#

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;

glpOpenWindow;
glClearColor(0,0,1,1);
glClear(GL_COLOR_BUFFER_BIT);
glOrtho(-1,1,-1,1,-1,1);

glColor3f(1,0,0);
glBegin(GL_POLYGON);
  glVertex2f(-0.5,-0.5);
  glVertex2f(-0.5, 0.5);
  glVertex2f( 0.5, 0.5);
  glVertex2f( 0.5,-0.5);
glEnd();
glpFlush();

print "Program 1-1 Simple, hit Enter in terminal window to quit:\n\n";
glpMainLoop;