Merge branch 'nouveau-import'
[mesa.git] / progs / tests / texgenmix.c
1
2 /*
3 * Demonstrates mixed texgen/non-texgen texture coordinates.
4 */
5
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include <GL/glut.h>
10
11 #undef max
12 #undef min
13 #define max( a, b ) ((a) >= (b) ? (a) : (b))
14 #define min( a, b ) ((a) <= (b) ? (a) : (b))
15
16 GLfloat labelColor0[4] = { 1.0, 1.0, 1.0, 1.0 };
17 GLfloat labelColor1[4] = { 1.0, 1.0, 0.4, 1.0 };
18 GLfloat *labelInfoColor = labelColor0;
19
20 GLboolean doubleBuffered = GL_TRUE;
21 GLboolean drawTextured = GL_TRUE;
22
23 int textureWidth = 64;
24 int textureHeight = 64;
25
26 int winWidth = 580, winHeight = 720;
27
28 const GLfloat texmat_swap_rq[16] = { 1.0, 0.0, 0.0, 0.0,
29 0.0, 1.0, 0.0, 0.0,
30 0.0, 0.0, 0.0, 1.0,
31 0.0, 0.0, 1.0, 0.0};
32
33 const GLfloat nullPlane[4] = { 0.0, 0.0, 0.0, 0.0 };
34 const GLfloat ObjPlaneS1[4] = { 1.0, 0.0, 1.0, 0.0 };
35 const GLfloat ObjPlaneS2[4] = { 0.5, 0.0, 0.0, 0.0 };
36 const GLfloat ObjPlaneS3[4] = { 1.0, 0.0, 0.0, 0.0 };
37 const GLfloat ObjPlaneT[4] = { 0.0, 1.0, 0.0, 0.0 };
38 const GLfloat ObjPlaneT2[4] = { 0.0, 0.5, 0.0, 0.0 };
39 const GLfloat ObjPlaneT3[4] = { 0.0, 1.0, 0.0, 0.0 };
40 const GLfloat ObjPlaneR[4] = { 0.0, 0.0, 1.0, 0.0 };
41 const GLfloat ObjPlaneQ[4] = { 0.0, 0.0, 0.0, 0.5 };
42
43
44 static void checkErrors( void )
45 {
46 GLenum error;
47
48 while ( (error = glGetError()) != GL_NO_ERROR ) {
49 fprintf( stderr, "Error: %s\n", (char *) gluErrorString( error ) );
50 }
51 }
52
53 static void drawString( const char *string, GLfloat x, GLfloat y,
54 const GLfloat color[4] )
55 {
56 glColor4fv( color );
57 glRasterPos2f( x, y );
58
59 while ( *string ) {
60 glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_10, *string );
61 string++;
62 }
63 }
64
65 static void begin2D( int width, int height )
66 {
67 glMatrixMode( GL_PROJECTION );
68
69 glPushMatrix();
70 glLoadIdentity();
71
72 glOrtho( 0, width, 0, height, -1, 1 );
73 glMatrixMode( GL_MODELVIEW );
74
75 glPushMatrix();
76 glLoadIdentity();
77 }
78
79 static void end2D( void )
80 {
81 glMatrixMode( GL_PROJECTION );
82 glPopMatrix();
83 glMatrixMode( GL_MODELVIEW );
84 glPopMatrix();
85 }
86
87 static void initialize( void )
88 {
89 glMatrixMode( GL_PROJECTION );
90 glLoadIdentity();
91
92 glOrtho( -1.5, 1.5, -1.5, 1.5, -1.5, 1.5 );
93
94 glMatrixMode(GL_MODELVIEW);
95 glLoadIdentity();
96
97 glShadeModel( GL_FLAT );
98 }
99
100 /* ARGSUSED1 */
101 static void keyboard( unsigned char c, int x, int y )
102 {
103 switch ( c ) {
104 case 't':
105 drawTextured = !drawTextured;
106 break;
107 case 27: /* Escape key should force exit. */
108 exit(0);
109 break;
110 default:
111 break;
112 }
113 glutPostRedisplay();
114 }
115
116 /* ARGSUSED1 */
117 static void special( int key, int x, int y )
118 {
119 switch ( key ) {
120 case GLUT_KEY_DOWN:
121 break;
122 case GLUT_KEY_UP:
123 break;
124 case GLUT_KEY_LEFT:
125 break;
126 case GLUT_KEY_RIGHT:
127 break;
128 default:
129 break;
130 }
131 glutPostRedisplay();
132 }
133
134 static void
135 reshape( int w, int h )
136 {
137 winWidth = w;
138 winHeight = h;
139 /* No need to call glViewPort here since "draw" calls it! */
140 }
141
142 static void loadTexture( int width, int height )
143 {
144 int alphaSize = 1;
145 int rgbSize = 3;
146 GLubyte *texImage, *p;
147 int elementsPerGroup, elementSize, groupSize, rowSize;
148 int i, j;
149
150
151 elementsPerGroup = alphaSize + rgbSize;
152 elementSize = sizeof(GLubyte);
153 groupSize = elementsPerGroup * elementSize;
154 rowSize = width * groupSize;
155
156 if ( (texImage = (GLubyte *) malloc( height * rowSize ) ) == NULL ) {
157 fprintf( stderr, "texture malloc failed\n" );
158 return;
159 }
160
161 for ( i = 0 ; i < height ; i++ )
162 {
163 p = texImage + i * rowSize;
164
165 for ( j = 0 ; j < width ; j++ )
166 {
167 if ( rgbSize > 0 )
168 {
169 /**
170 ** +-----+-----+
171 ** | | |
172 ** | R | G |
173 ** | | |
174 ** +-----+-----+
175 ** | | |
176 ** | Y | B |
177 ** | | |
178 ** +-----+-----+
179 **/
180 if ( i > height / 2 ) {
181 if ( j < width / 2 ) {
182 p[0] = 0xff;
183 p[1] = 0x00;
184 p[2] = 0x00;
185 } else {
186 p[0] = 0x00;
187 p[1] = 0xff;
188 p[2] = 0x00;
189 }
190 } else {
191 if ( j < width / 2 ) {
192 p[0] = 0xff;
193 p[1] = 0xff;
194 p[2] = 0x00;
195 } else {
196 p[0] = 0x00;
197 p[1] = 0x00;
198 p[2] = 0xff;
199 }
200 }
201 p += 3 * elementSize;
202 }
203
204 if ( alphaSize > 0 )
205 {
206 /**
207 ** +-----------+
208 ** | W |
209 ** | +-----+ |
210 ** | | | |
211 ** | | B | |
212 ** | | | |
213 ** | +-----+ |
214 ** | |
215 ** +-----------+
216 **/
217 int i2 = i - height / 2;
218 int j2 = j - width / 2;
219 int h8 = height / 8;
220 int w8 = width / 8;
221 if ( -h8 <= i2 && i2 <= h8 && -w8 <= j2 && j2 <= w8 ) {
222 p[0] = 0x00;
223 } else if ( -2 * h8 <= i2 && i2 <= 2 * h8 && -2 * w8 <= j2 && j2 <= 2 * w8 ) {
224 p[0] = 0x55;
225 } else if ( -3 * h8 <= i2 && i2 <= 3 * h8 && -3 * w8 <= j2 && j2 <= 3 * w8 ) {
226 p[0] = 0xaa;
227 } else {
228 p[0] = 0xff;
229 }
230 p += elementSize;
231 }
232 }
233 }
234
235 glTexImage2D( GL_TEXTURE_2D, 0,
236 GL_RGBA, width, height, 0,
237 GL_RGBA, GL_UNSIGNED_BYTE, texImage );
238
239 free( texImage );
240 }
241
242
243 static void drawSample( int x, int y, int w, int h,
244 int texgenenabled, int coordnr )
245 {
246 char buf[255];
247
248 glViewport( x, y, w, h );
249 glScissor( x, y, w, h );
250
251 glClearColor( 0.1, 0.1, 0.1, 1.0 );
252 glClear( GL_COLOR_BUFFER_BIT );
253
254 begin2D( w, h );
255 if (texgenenabled == 2) {
256 sprintf( buf, "TexCoord%df", coordnr);
257 drawString( buf, 10, h - 15, labelInfoColor );
258 sprintf( buf, "texgen enabled for %s coordinate(s)", coordnr == 2 ? "S" : "S/T");
259 drawString( buf, 10, 5, labelInfoColor );
260 }
261 else if (texgenenabled == 0) {
262 sprintf( buf, "TexCoord%df", coordnr);
263 drawString( buf, 10, h - 15, labelInfoColor );
264 drawString( "no texgen", 10, 5, labelInfoColor );
265 }
266 else if (texgenenabled == 1) {
267 drawString( "no TexCoord", 10, h - 15, labelInfoColor );
268 sprintf( buf, "texgen enabled for %s coordinate(s)",
269 coordnr == 2 ? "S/T" : (coordnr == 3 ? "S/T/R" : "S/T/R/Q"));
270 drawString( buf, 10, 5, labelInfoColor );
271 }
272
273 end2D();
274
275 glTexEnvi( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
276
277 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
278 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
279
280 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );
281 glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );
282
283 loadTexture( textureWidth, textureHeight );
284
285 if ( drawTextured ) {
286 glEnable( GL_TEXTURE_2D );
287 }
288
289 glDisable( GL_TEXTURE_GEN_S );
290 glDisable( GL_TEXTURE_GEN_T );
291 glDisable( GL_TEXTURE_GEN_R );
292 glDisable( GL_TEXTURE_GEN_Q );
293
294 glMatrixMode( GL_TEXTURE );
295 glLoadIdentity();
296 glMatrixMode( GL_MODELVIEW );
297 glPushMatrix();
298
299 switch (coordnr) {
300 case 2:
301 switch (texgenenabled) {
302 case 0:
303 glBegin( GL_QUADS );
304 glTexCoord2f( 0.0, 0.0 );
305 glVertex2f( -0.8, -0.8 );
306
307 glTexCoord2f( 1.0, 0.0 );
308 glVertex2f( 0.8, -0.8 );
309
310 glTexCoord2f( 1.0, 1.0 );
311 glVertex2f( 0.8, 0.8 );
312
313 glTexCoord2f( 0.0, 1.0 );
314 glVertex2f( -0.8, 0.8 );
315 glEnd();
316 break;
317 case 1:
318 glTranslatef( -0.8, -0.8, 0.0 );
319 glScalef( 1.6, 1.6, 1.0 );
320 glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
321 glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
322 glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
323 glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
324 glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS3);
325 glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT3);
326 glTexGenfv(GL_R, GL_OBJECT_PLANE, nullPlane);
327 glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane);
328
329 glEnable( GL_TEXTURE_GEN_S );
330 glEnable( GL_TEXTURE_GEN_T );
331
332 /* Issue a texcoord here to be sure Q isn't left over from a
333 * previous sample.
334 */
335 glTexCoord1f( 0.0 );
336 glBegin( GL_QUADS );
337 glVertex2f( 0.0, 0.0 );
338 glVertex2f( 1.0, 0.0 );
339 glVertex2f( 1.0, 1.0 );
340 glVertex2f( 0.0, 1.0 );
341 glEnd();
342 break;
343 case 2:
344 /* make sure that texgen T and non-texgen S coordinate are wrong */
345 glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
346 glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
347 glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
348 glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
349 glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS1);
350 glTexGenfv(GL_T, GL_OBJECT_PLANE, nullPlane);
351 glTexGenfv(GL_R, GL_OBJECT_PLANE, nullPlane);
352 glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane);
353
354 glEnable( GL_TEXTURE_GEN_S );
355
356 glBegin( GL_QUADS );
357 /* use z coordinate to get correct texgen values... */
358 glTexCoord2f( 0.0, 0.0 );
359 glVertex3f( -0.8, -0.8, 0.8 );
360
361 glTexCoord2f( 0.0, 0.0 );
362 glVertex3f( 0.8, -0.8, 0.2 );
363
364 glTexCoord2f( 0.0, 1.0 );
365 glVertex3f( 0.8, 0.8, 0.2 );
366
367 glTexCoord2f( 0.0, 1.0 );
368 glVertex3f( -0.8, 0.8, 0.8 );
369 glEnd();
370 break;
371 }
372 break;
373 case 3:
374 glMatrixMode( GL_TEXTURE );
375 glLoadMatrixf( texmat_swap_rq );
376 glMatrixMode( GL_MODELVIEW );
377 glTranslatef( -0.8, -0.8, 0.0 );
378 glScalef( 1.6, 1.6, 1.0 );
379 switch (texgenenabled) {
380 case 0:
381 glBegin( GL_QUADS );
382 glTexCoord3f( 0.0, 0.0, 0.5 );
383 glVertex2f( 0.0, 0.0 );
384
385 glTexCoord3f( 0.5, 0.0, 0.5 );
386 glVertex2f( 1.0, 0.0 );
387
388 glTexCoord3f( 0.5, 0.5, 0.5 );
389 glVertex2f( 1.0, 1.0 );
390
391 glTexCoord3f( 0.0, 0.5, 0.5 );
392 glVertex2f( 0.0, 1.0 );
393 glEnd();
394 break;
395 case 1:
396 glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
397 glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
398 glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
399 glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
400 glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS2);
401 glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT2);
402 glTexGenfv(GL_R, GL_OBJECT_PLANE, ObjPlaneR);
403 glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane);
404
405 glEnable( GL_TEXTURE_GEN_S );
406 glEnable( GL_TEXTURE_GEN_T );
407 glEnable( GL_TEXTURE_GEN_R );
408
409 glTexCoord1f( 0.0 ); /* to make sure Q is 1.0 */
410 glBegin( GL_QUADS );
411 glVertex3f( 0.0, 0.0, 0.5 );
412 glVertex3f( 1.0, 0.0, 0.5 );
413 glVertex3f( 1.0, 1.0, 0.5 );
414 glVertex3f( 0.0, 1.0, 0.5 );
415 glEnd();
416 break;
417 case 2:
418 /* make sure that texgen R/Q and non-texgen S/T coordinates are wrong */
419 glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
420 glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
421 glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
422 glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
423 glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS2);
424 glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT2);
425 glTexGenfv(GL_R, GL_OBJECT_PLANE, nullPlane);
426 glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane);
427
428 glEnable( GL_TEXTURE_GEN_S );
429 glEnable( GL_TEXTURE_GEN_T );
430
431 glBegin( GL_QUADS );
432 glTexCoord3f( 0.0, 0.0, 0.5 );
433 glVertex2f( 0.0, 0.0);
434
435 glTexCoord3f( 0.0, 0.0, 0.5 );
436 glVertex2f( 1.0, 0.0);
437
438 glTexCoord3f( 0.0, 0.0, 0.5 );
439 glVertex2f( 1.0, 1.0);
440
441 glTexCoord3f( 0.0, 0.0, 0.5 );
442 glVertex2f( 0.0, 1.0);
443 glEnd();
444 break;
445 }
446 break;
447 case 4:
448 switch (texgenenabled) {
449 case 0:
450 glBegin( GL_QUADS );
451 /* don't need r coordinate but still setting it I'm mean */
452 glTexCoord4f( 0.0, 0.0, 0.0, 0.5 );
453 glVertex2f( -0.8, -0.8 );
454
455 glTexCoord4f( 0.5, 0.0, 0.2, 0.5 );
456 glVertex2f( 0.8, -0.8 );
457
458 glTexCoord4f( 0.5, 0.5, 0.5, 0.5 );
459 glVertex2f( 0.8, 0.8 );
460
461 glTexCoord4f( 0.0, 0.5, 0.5, 0.5 );
462 glVertex2f( -0.8, 0.8 );
463 glEnd();
464 break;
465 case 1:
466 glTranslatef( -0.8, -0.8, 0.0 );
467 glScalef( 1.6, 1.6, 1.0 );
468 /* make sure that texgen R/Q and non-texgen S/T coordinates are wrong */
469 glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
470 glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
471 glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
472 glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
473 glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS2);
474 glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT2);
475 glTexGenfv(GL_R, GL_OBJECT_PLANE, ObjPlaneR);
476 glTexGenfv(GL_Q, GL_OBJECT_PLANE, ObjPlaneQ);
477
478 glEnable( GL_TEXTURE_GEN_S );
479 glEnable( GL_TEXTURE_GEN_T );
480 glEnable( GL_TEXTURE_GEN_R );
481 glEnable( GL_TEXTURE_GEN_Q );
482
483 glBegin( GL_QUADS );
484 glVertex2f( 0.0, 0.0 );
485 glVertex2f( 1.0, 0.0 );
486 glVertex2f( 1.0, 1.0 );
487 glVertex2f( 0.0, 1.0 );
488 glEnd();
489 break;
490 case 2:
491 glTranslatef( -0.8, -0.8, 0.0 );
492 glScalef( 1.6, 1.6, 1.0 );
493 /* make sure that texgen R/Q and non-texgen S/T coordinates are wrong */
494 glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
495 glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
496 glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
497 glTexGeni( GL_Q, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR );
498 glTexGenfv(GL_S, GL_OBJECT_PLANE, ObjPlaneS2);
499 glTexGenfv(GL_T, GL_OBJECT_PLANE, ObjPlaneT2);
500 glTexGenfv(GL_R, GL_OBJECT_PLANE, nullPlane);
501 glTexGenfv(GL_Q, GL_OBJECT_PLANE, nullPlane);
502
503 glEnable( GL_TEXTURE_GEN_S );
504 glEnable( GL_TEXTURE_GEN_T );
505
506 glBegin( GL_QUADS );
507 glTexCoord4f( 0.0, 0.0, 0.0, 0.5 );
508 glVertex2f( 0.0, 0.0 );
509
510 glTexCoord4f( 0.0, 0.0, 0.2, 0.5 );
511 glVertex2f( 1.0, 0.0 );
512
513 glTexCoord4f( 0.0, 0.0, 0.5, 0.5 );
514 glVertex2f( 1.0, 1.0 );
515
516 glTexCoord4f( 0.0, 0.0, 0.75, 0.5 );
517 glVertex2f( 0.0, 1.0 );
518 glEnd();
519 break;
520 }
521 break;
522 }
523
524 glPopMatrix();
525 glDisable( GL_TEXTURE_2D );
526
527 }
528
529 static void display( void )
530 {
531 int numX = 3, numY = 3;
532 float xBase = (float) winWidth * 0.01;
533 float xOffset = (winWidth - xBase) / numX;
534 float xSize = max( xOffset - xBase, 1 );
535 float yBase = (float) winHeight * 0.01;
536 float yOffset = (winHeight - yBase) / numY;
537 float ySize = max( yOffset - yBase, 1 );
538 float x, y;
539 int i, j;
540
541 glViewport( 0, 0, winWidth, winHeight );
542 glDisable( GL_SCISSOR_TEST );
543 glClearColor( 0.0, 0.0, 0.0, 0.0 );
544 glClear( GL_COLOR_BUFFER_BIT );
545 glEnable( GL_SCISSOR_TEST );
546
547 x = xBase;
548 y = (winHeight - 1) - yOffset;
549
550 for ( i = 0 ; i < numY ; i++ )
551 {
552
553 labelInfoColor = labelColor1;
554
555
556 for ( j = 0 ; j < numX ; j++ ) {
557 drawSample( x, y, xSize, ySize, i, j+2 );
558 x += xOffset;
559 }
560
561 x = xBase;
562 y -= yOffset;
563 }
564
565 if ( doubleBuffered ) {
566 glutSwapBuffers();
567 } else {
568 glFlush();
569 }
570
571 checkErrors();
572 }
573
574 static void usage( char *name )
575 {
576 fprintf( stderr, "usage: %s [ options ]\n", name );
577 fprintf( stderr, "\n" );
578 fprintf( stderr, "options:\n" );
579 fprintf( stderr, " -sb single buffered\n" );
580 fprintf( stderr, " -db double buffered\n" );
581 fprintf( stderr, " -info print OpenGL driver info\n" );
582 }
583
584 static void instructions( void )
585 {
586 fprintf( stderr, "texgenmix - mixed texgen/non-texgen texture coordinate test\n" );
587 fprintf( stderr, "all quads should look the same!\n" );
588 fprintf( stderr, "\n" );
589 fprintf( stderr, " [t] - toggle texturing\n" );
590 }
591
592 int main( int argc, char *argv[] )
593 {
594 GLboolean info = GL_FALSE;
595 int i;
596
597 glutInit( &argc, argv );
598
599 for ( i = 1 ; i < argc ; i++ ) {
600 if ( !strcmp( "-sb", argv[i] ) ) {
601 doubleBuffered = GL_FALSE;
602 } else if ( !strcmp( "-db", argv[i] ) ) {
603 doubleBuffered = GL_TRUE;
604 } else if ( !strcmp( "-info", argv[i] ) ) {
605 info = GL_TRUE;
606 } else {
607 usage( argv[0] );
608 exit( 1 );
609 }
610 }
611
612 if ( doubleBuffered ) {
613 glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );
614 } else {
615 glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE );
616 }
617
618 glutInitWindowSize( winWidth, winHeight );
619 glutInitWindowPosition( 0, 0 );
620 glutCreateWindow( "Mixed texgen/non-texgen texture coordinate test" );
621
622 initialize();
623 instructions();
624
625 if ( info ) {
626 printf( "\n" );
627 printf( "GL_RENDERER = %s\n", (char *) glGetString( GL_RENDERER ) );
628 printf( "GL_VERSION = %s\n", (char *) glGetString( GL_VERSION ) );
629 printf( "GL_VENDOR = %s\n", (char *) glGetString( GL_VENDOR ) ) ;
630 printf( "GL_EXTENSIONS = %s\n", (char *) glGetString( GL_EXTENSIONS ) );
631 }
632
633 glutDisplayFunc( display );
634 glutReshapeFunc( reshape );
635 glutKeyboardFunc( keyboard );
636 glutSpecialFunc( special );
637 glutMainLoop();
638
639 return 0;
640 }