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
31
GLenum rgb, doubleBuffer, windType;
38
static void Init(void)
41
glutSetCursor(cursor);
42
glClearColor(0.0, 0.0, 0.0, 0.0);
46
static void Reshape(int width, int height)
51
glViewport(0, 0, windX, windY);
53
glMatrixMode(GL_PROJECTION);
55
gluOrtho2D(0, windX, 0, windY);
56
glMatrixMode(GL_MODELVIEW);
59
static void Key(unsigned char key, int x, int y)
70
glutSetCursor(cursor);
74
static void Draw(void)
77
glClear(GL_COLOR_BUFFER_BIT);
80
SetColor(COLOR_BLACK);
84
SetColor(COLOR_GREEN);
85
glVertex2i(windX, windY);
97
static GLenum Args(int argc, char **argv)
102
doubleBuffer = GL_FALSE;
104
for (i = 1; i < argc; i++) {
105
if (strcmp(argv[i], "-ci") == 0) {
107
} else if (strcmp(argv[i], "-rgb") == 0) {
109
} else if (strcmp(argv[i], "-sb") == 0) {
110
doubleBuffer = GL_FALSE;
111
} else if (strcmp(argv[i], "-db") == 0) {
112
doubleBuffer = GL_TRUE;
114
printf("%s (Bad option).\n", argv[i]);
121
int main(int argc, char **argv)
123
glutInit(&argc, argv);
125
if (Args(argc, argv) == GL_FALSE) {
131
glutInitWindowPosition(0, 0); glutInitWindowSize( windX, windY);
133
windType = (rgb) ? GLUT_RGB : GLUT_INDEX;
134
windType |= (doubleBuffer) ? GLUT_DOUBLE : GLUT_SINGLE;
135
glutInitDisplayMode(windType);
137
if (glutCreateWindow("Cursor Test") == GL_FALSE) {
145
glutReshapeFunc(Reshape);
146
glutKeyboardFunc(Key);
147
glutDisplayFunc(Draw);