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
28 #include "glut_wrap.h"
30 static GLenum frontface
= GL_CCW
;
36 fprintf(stderr
, "GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER
));
37 fprintf(stderr
, "GL_VERSION = %s\n", (char *) glGetString(GL_VERSION
));
38 fprintf(stderr
, "GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR
));
44 Reshape(int width
, int height
)
46 glViewport(0, 0, (GLint
)width
, (GLint
)height
);
47 glMatrixMode(GL_PROJECTION
);
49 glMatrixMode(GL_MODELVIEW
);
54 Key(unsigned char key
, int x
, int y
)
58 frontface
= (frontface
== GL_CCW
) ? GL_CW
: GL_CCW
;
59 glFrontFace(frontface
);
73 static GLboolean flags
[3] = { 1, 0, 1};
74 static GLfloat color
[3][3] = {
79 static GLfloat vert
[3][3] = {
85 glClear(GL_COLOR_BUFFER_BIT
);
86 glPolygonMode(GL_FRONT
, GL_LINE
);
87 glPolygonMode(GL_BACK
, GL_POINT
);
89 glVertexPointer(3, GL_FLOAT
, 0, vert
);
90 glColorPointer(3, GL_FLOAT
, 0, color
);
91 glEdgeFlagPointer(0, flags
);
92 glEnableClientState(GL_VERTEX_ARRAY
);
93 glEnableClientState(GL_COLOR_ARRAY
);
94 glEnableClientState(GL_EDGE_FLAG_ARRAY
);
96 glDrawArrays(GL_TRIANGLES
, 0, 3);
103 main(int argc
, char **argv
)
105 glutInit(&argc
, argv
);
107 glutInitWindowPosition(0, 0);
108 glutInitWindowSize( 250, 250);
109 glutInitDisplayMode(GLUT_RGB
| GLUT_ALPHA
| GLUT_DOUBLE
);
110 if (!glutCreateWindow(*argv
)) {
113 glutReshapeFunc(Reshape
);
114 glutKeyboardFunc(Key
);
115 glutDisplayFunc(Draw
);