File: smooth.pl

package info (click to toggle)
libopengl-perl 0.7004%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,088 kB
  • sloc: perl: 9,701; ansic: 8,090; makefile: 110
file content (32 lines) | stat: -rw-r--r-- 716 bytes parent folder | download
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
#            smooth
#
# This program demonstrates smooth shading.
# A smooth shaded polygon is drawn in a 2-D projection.
# This example adapted from smooth.c from "OpenGL Programming Guide" 

use OpenGL;

sub triangle{
    glBegin (GL_TRIANGLES);
    glColor3f (1.0, 0.0, 0.0);
    glVertex2f (5.0, 5.0);
    glColor3f (0.0, 1.0, 0.0);
    glVertex2f (25.0, 5.0);
    glColor3f (0.0, 0.0, 1.0);
    glVertex2f (5.0, 25.0);
    glEnd ();
}

glpOpenWindow;
# GL_SMOOTH is actually the default shading model. 
glShadeModel (GL_SMOOTH);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D (0.0, 30.0, 0.0, 30.0);
glMatrixMode(GL_MODELVIEW);

glClear (GL_COLOR_BUFFER_BIT);
triangle ();
glpFlush ();

glpMainLoop;