File: helix.c

package info (click to toggle)
gle 3.1.0-5.3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,068 kB
  • ctags: 1,029
  • sloc: ansic: 10,002; sh: 8,455; makefile: 366; python: 102
file content (47 lines) | stat: -rw-r--r-- 1,163 bytes parent folder | download | duplicates (9)
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

/* 
 * helicoid (gernalized torus) demo 
 *
 * FUNCTION:
 * This code provides a very simple example of the helicoid primitive.
 * Most of this code is required to set up OpenGL and GLUT, and very
 * very little to set up the helix drawer. Don't blink!
 *
 * HISTORY:
 * Written by Linas Vepstas, March 1995
 * Copyright (c) 1995 Linas Vepstas <linas@linas.org>
 */

/* required include files */
#include <GL/gl.h>
#include <GL/glut.h>
#include <GL/gle.h>
#include "main.h"

void InitStuff (void) {
   lastx = 121.0;
   lasty = 121.0;
}

/* draw the helix shape */
void DrawStuff (void) {

   glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
   glColor3f (0.6, 0.8, 0.3);

   /* set up some matrices so that the object spins with the mouse */
   glPushMatrix ();
   glTranslatef (0.0, 0.0, -80.0);
   glRotatef (lastx, 0.0, 1.0, 0.0);
   glRotatef (lasty, 1.0, 0.0, 0.0);

   /* Phew. FINALLY, Draw the helix  -- */
   gleSetJoinStyle (TUBE_NORM_EDGE | TUBE_JN_ANGLE | TUBE_JN_CAP);
   gleHelicoid (1.0, 6.0, 2.0, -3.0, 4.0, 0x0, 0x0, 0.0, 1080.0);

   glPopMatrix ();

   glutSwapBuffers ();
}

/* ------------------------- end of file ----------------- */