2
* Copyright (c) 1993-2003, Silicon Graphics, Inc.
5
* Permission to use, copy, modify, and distribute this software for any
6
* purpose and without fee is hereby granted, provided that the above
7
* copyright notice appear in all copies and that both the copyright
8
* notice and this permission notice appear in supporting documentation,
9
* and that the name of Silicon Graphics, Inc. not be used in
10
* advertising or publicity pertaining to distribution of the software
11
* without specific, written prior permission.
13
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" AND
14
* WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
15
* INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
16
* FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
17
* GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
18
* SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
19
* OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION, LOSS OF
20
* PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF THIRD
21
* PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN ADVISED OF
22
* THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON ANY THEORY OF
23
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE POSSESSION, USE
24
* OR PERFORMANCE OF THIS SOFTWARE.
26
* US Government Users Restricted Rights
27
* Use, duplication, or disclosure by the Government is subject to
28
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
29
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
30
* clause at DFARS 252.227-7013 and/or in similar or successor clauses
31
* in the FAR or the DOD or NASA FAR Supplement. Unpublished - rights
32
* reserved under the copyright laws of the United States.
34
* Contractor/manufacturer is:
35
* Silicon Graphics, Inc.
36
* 1500 Crittenden Lane
37
* Mountain View, CA 94043
38
* United State of America
40
* OpenGL(R) is a registered trademark of Silicon Graphics, Inc.
45
* This program demonstrates multiple vertex arrays,
46
* specifically the OpenGL routine glMultiDrawElements().
56
static void setupPointer(void)
58
static GLint vertices[] = {25, 25,
71
glEnableClientState (GL_VERTEX_ARRAY);
72
glVertexPointer (2, GL_INT, 0, vertices);
75
static void init(void)
77
glClearColor (0.0, 0.0, 0.0, 0.0);
78
glShadeModel (GL_SMOOTH);
82
static void display(void)
84
static GLubyte oneIndices[] = {0, 1, 2, 3, 4, 5, 6};
85
static GLubyte twoIndices[] = {1, 7, 8, 9, 10, 11};
86
static GLsizei count[] = {7, 6};
87
static GLvoid * indices[2] = {oneIndices, twoIndices};
89
glClear (GL_COLOR_BUFFER_BIT);
90
glColor3f (1.0, 1.0, 1.0);
91
glMultiDrawElementsEXT (GL_LINE_STRIP, count, GL_UNSIGNED_BYTE,
92
(const GLvoid **) indices, 2);
96
static void reshape (int w, int h)
98
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
99
glMatrixMode (GL_PROJECTION);
101
gluOrtho2D (0.0, (GLdouble) w, 0.0, (GLdouble) h);
104
static void keyboard(unsigned char key, int x, int y)
113
int main(int argc, char** argv)
115
glutInit(&argc, argv);
116
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
117
glutInitWindowSize (350, 350);
118
glutInitWindowPosition (100, 100);
119
glutCreateWindow (argv[0]);
122
glutDisplayFunc(display);
123
glutReshapeFunc(reshape);
124
glutKeyboardFunc (keyboard);
129
int main(int argc, char** argv)
131
fprintf (stderr, "This program demonstrates a feature which is not in OpenGL Version 1.0.\n");
132
fprintf (stderr, "If your implementation of OpenGL Version 1.0 has the right extensions,\n");
133
fprintf (stderr, "you may be able to modify this program to make it run.\n");