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