2
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
4
* Permission to use, copy, modify, distribute, and sell this software and
5
* its documentation for any purpose is hereby granted without fee, provided
6
* that (i) the above copyright notices and this permission notice appear in
7
* all copies of the software and related documentation, and (ii) the name of
8
* Silicon Graphics may not be used in any advertising or
9
* publicity relating to the software without the specific, prior written
10
* permission of Silicon Graphics.
12
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
14
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
15
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
17
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
18
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
20
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
21
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
34
GLenum rgb, doubleBuffer, windType;
54
static void Init(void)
58
glClearColor(0.0, 0.0, 0.0, 0.0);
60
glLineStipple(1, 0xF0E0);
61
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
64
for (i = 0; i < 16; i++) {
65
glutSetColor(i+CI_OFFSET, i/15.0, i/15.0, 0.0);
74
static void Reshape(int width, int height)
77
glViewport(0, 0, (GLint)width, (GLint)height);
79
glMatrixMode(GL_PROJECTION);
81
gluOrtho2D(-175, 175, -175, 175);
82
glMatrixMode(GL_MODELVIEW);
85
static void Key(unsigned char key, int x, int y)
113
static void Draw(void)
117
glClear(GL_COLOR_BUFFER_BIT);
122
glEnable(GL_LINE_STIPPLE);
124
glDisable(GL_LINE_STIPPLE);
129
glEnable(GL_LINE_SMOOTH);
133
glDisable(GL_LINE_SMOOTH);
139
glShadeModel( GL_FLAT );
141
for (i = 0; i < 360; i += 5) {
142
glRotatef(5.0, 0,0,1);
144
(rgb) ? glColor3f(1.0, 1.0, 0.0) : glIndexi(ci);
145
glBegin(GL_LINE_STRIP);
152
SetColor(COLOR_GREEN);
168
static GLenum Args(int argc, char **argv)
173
doubleBuffer = GL_TRUE;
175
for (i = 1; i < argc; i++) {
176
if (strcmp(argv[i], "-ci") == 0) {
178
} else if (strcmp(argv[i], "-rgb") == 0) {
180
} else if (strcmp(argv[i], "-sb") == 0) {
181
doubleBuffer = GL_FALSE;
182
} else if (strcmp(argv[i], "-db") == 0) {
183
doubleBuffer = GL_TRUE;
185
printf("%s (Bad option).\n", argv[i]);
192
int main(int argc, char **argv)
194
glutInit(&argc, argv);
196
if (Args(argc, argv) == GL_FALSE) {
200
glutInitWindowPosition(0, 0); glutInitWindowSize( 300, 300);
202
windType = (rgb) ? GLUT_RGB : GLUT_INDEX;
203
windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
204
glutInitDisplayMode(windType);
206
if (glutCreateWindow("Line Test") == GL_FALSE) {
214
glutReshapeFunc(Reshape);
215
glutKeyboardFunc(Key);
216
glutDisplayFunc(Draw);