2
* Copyright (c) 1991, 1992, 1993 Silicon Graphics, Inc.
3
* Copyright (c) 2009 VMware, Inc.
5
* Permission to use, copy, modify, distribute, and sell this software and
6
* its documentation for any purpose is hereby granted without fee, provided
7
* that (i) the above copyright notices and this permission notice appear in
8
* all copies of the software and related documentation, and (ii) the name of
9
* Silicon Graphics may not be used in any advertising or
10
* publicity relating to the software without the specific, prior written
11
* permission of Silicon Graphics.
13
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF
15
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
16
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
18
* IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR
19
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
20
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
21
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
22
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
40
static void init(void)
42
fprintf(stderr, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER));
43
fprintf(stderr, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION));
44
fprintf(stderr, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR));
50
static void reshape(int width, int height)
52
glViewport(0, 0, 100, 100);
57
glMatrixMode(GL_PROJECTION);
59
glOrtho(-1.0, 1.0, -1.0, 1.0, -0.5, 1000.0);
60
glMatrixMode(GL_MODELVIEW);
63
static void key(unsigned char key, int x, int y)
75
static void drawQuad(void)
78
glVertex2d(-1.0, -1.0);
79
glVertex2d( 1.0, -1.0);
80
glVertex2d( 1.0, 1.0);
81
glVertex2d(-1.0, 1.0);
85
static void draw(void)
89
glClearColor(0.0, 0.0, 1.0, 0.0);
90
glClear(GL_COLOR_BUFFER_BIT);
96
glEnable(GL_SCISSOR_TEST);
99
glColor4d(1.0, 0.0, 0.0, 1.0);
101
glScissor(i, i, 10 - 2*i, 10 - 2*i);
105
glDisable(GL_SCISSOR_TEST);
107
/* glutSwapBuffers(); */
111
int main(int argc, char **argv)
115
glutInit(&argc, argv);
120
glutInitWindowPosition(100, 0);
121
glutInitWindowSize(prog.width, prog.height);
123
/* type = GLUT_RGB | GLUT_DOUBLE; */
124
type = GLUT_RGB | GLUT_SINGLE;
125
glutInitDisplayMode(type);
127
if (glutCreateWindow(*argv) == GL_FALSE) {
133
glutReshapeFunc(reshape);
134
glutKeyboardFunc(key);
135
glutDisplayFunc(draw);