/usr/share/doc/gle-doc/examples/cylinder.c is in gle-doc 3.1.0-7.2.
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | /*
* cylinder drawing demo
*
* FUNCTION:
* Basic demo illustrating how to write code to draw
* the most basic cylinder shape.
*
* HISTORY:
* 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"
/* the arrays in which we will store out polyline */
#define NPTS 6
double points [NPTS][3];
float colors [NPTS][3];
int idx = 0;
/* some utilities for filling that array */
#define PNT(x,y,z) { \
points[idx][0] = x; \
points[idx][1] = y; \
points[idx][2] = z; \
idx ++; \
}
#define COL(r,g,b) { \
colors[idx][0] = r; \
colors[idx][1] = g; \
colors[idx][2] = b; \
}
/*
* Initialize a bent shape with three segments.
* The data format is a polyline.
*
* NOTE that neither the first, nor the last segment are drawn.
* The first & last segment serve only to determine that angle
* at which the endcaps are drawn.
*/
void InitStuff (void) {
/* initialize the join style here */
gleSetJoinStyle (TUBE_NORM_EDGE | TUBE_JN_ANGLE | TUBE_JN_CAP);
COL (0.0, 0.0, 0.0);
PNT (-6.0, 6.0, 0.0);
COL (0.0, 0.8, 0.3);
PNT (6.0, 6.0, 0.0);
COL (0.8, 0.3, 0.0);
PNT (6.0, -6.0, 0.0);
COL (0.2, 0.3, 0.9);
PNT (-6.0, -6.0, 0.0);
COL (0.2, 0.8, 0.5);
PNT (-6.0, 6.0, 0.0);
COL (0.0, 0.0, 0.0);
PNT (6.0, 6.0, 0.0);
}
/* draw the cylinder shape */
void DrawStuff (void) {
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
/* 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 polycylinder -- */
glePolyCylinder (NPTS, points, colors, 2.3);
glPopMatrix ();
glutSwapBuffers ();
}
/* ------------------------ end of file ------------------- */
|