Merge commit 'origin/gallium-master-merge'
[mesa.git] / src / glew / visualinfo.c
1 /*
2 ** visualinfo.c
3 **
4 ** Copyright (C) Nate Robins, 1997
5 ** Michael Wimmer, 1999
6 ** Milan Ikits, 2002-2008
7 **
8 ** visualinfo is a small utility that displays all available visuals,
9 ** aka. pixelformats, in an OpenGL system along with renderer version
10 ** information. It shows a table of all the visuals that support OpenGL
11 ** along with their capabilities. The format of the table is similar to
12 ** that of glxinfo on Unix systems:
13 **
14 ** visual ~= pixel format descriptor
15 ** id = visual id (integer from 1 - max visuals)
16 ** tp = type (wn: window, pb: pbuffer, wp: window & pbuffer, bm: bitmap)
17 ** ac = acceleration (ge: generic, fu: full, no: none)
18 ** fm = format (i: integer, f: float, c: color index)
19 ** db = double buffer (y = yes)
20 ** sw = swap method (x: exchange, c: copy, u: undefined)
21 ** st = stereo (y = yes)
22 ** sz = total # bits
23 ** r = # bits of red
24 ** g = # bits of green
25 ** b = # bits of blue
26 ** a = # bits of alpha
27 ** axbf = # aux buffers
28 ** dpth = # bits of depth
29 ** stcl = # bits of stencil
30 */
31
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <string.h>
35 #include <GL/glew.h>
36 #if defined(_WIN32)
37 #include <GL/wglew.h>
38 #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
39 #include <AGL/agl.h>
40 #else
41 #include <GL/glxew.h>
42 #endif
43
44 #ifdef GLEW_MX
45 GLEWContext _glewctx;
46 # define glewGetContext() (&_glewctx)
47 # ifdef _WIN32
48 WGLEWContext _wglewctx;
49 # define wglewGetContext() (&_wglewctx)
50 # elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
51 GLXEWContext _glxewctx;
52 # define glxewGetContext() (&_glxewctx)
53 # endif
54 #endif /* GLEW_MX */
55
56 typedef struct GLContextStruct
57 {
58 #ifdef _WIN32
59 HWND wnd;
60 HDC dc;
61 HGLRC rc;
62 #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
63 AGLContext ctx, octx;
64 #else
65 Display* dpy;
66 XVisualInfo* vi;
67 GLXContext ctx;
68 Window wnd;
69 Colormap cmap;
70 #endif
71 } GLContext;
72
73 void InitContext (GLContext* ctx);
74 GLboolean CreateContext (GLContext* ctx);
75 void DestroyContext (GLContext* ctx);
76 void VisualInfo (GLContext* ctx);
77 void PrintExtensions (const char* s);
78 GLboolean ParseArgs (int argc, char** argv);
79
80 int showall = 0;
81 int displaystdout = 0;
82 int verbose = 0;
83 int drawableonly = 0;
84
85 char* display = NULL;
86 int visual = -1;
87
88 FILE* file = 0;
89 GLContext ctx;
90
91 int
92 main (int argc, char** argv)
93 {
94 GLenum err;
95
96 /* ---------------------------------------------------------------------- */
97 /* parse arguments */
98 if (GL_TRUE == ParseArgs(argc-1, argv+1))
99 {
100 #if defined(_WIN32)
101 fprintf(stderr, "Usage: visualinfo [-a] [-s] [-h] [-pf <id>]\n");
102 fprintf(stderr, " -a: show all visuals\n");
103 fprintf(stderr, " -s: display to stdout instead of visualinfo.txt\n");
104 fprintf(stderr, " -pf <id>: use given pixelformat\n");
105 fprintf(stderr, " -h: this screen\n");
106 #else
107 fprintf(stderr, "Usage: visualinfo [-h] [-display <display>] [-visual <id>]\n");
108 fprintf(stderr, " -h: this screen\n");
109 fprintf(stderr, " -display <display>: use given display\n");
110 fprintf(stderr, " -visual <id>: use given visual\n");
111 #endif
112 return 1;
113 }
114
115 /* ---------------------------------------------------------------------- */
116 /* create OpenGL rendering context */
117 InitContext(&ctx);
118 if (GL_TRUE == CreateContext(&ctx))
119 {
120 fprintf(stderr, "Error: CreateContext failed\n");
121 DestroyContext(&ctx);
122 return 1;
123 }
124
125 /* ---------------------------------------------------------------------- */
126 /* initialize GLEW */
127 glewExperimental = GL_TRUE;
128 #ifdef GLEW_MX
129 err = glewContextInit(glewGetContext());
130 # ifdef _WIN32
131 err = err || wglewContextInit(wglewGetContext());
132 # elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
133 err = err || glxewContextInit(glxewGetContext());
134 # endif
135 #else
136 err = glewInit();
137 #endif
138 if (GLEW_OK != err)
139 {
140 fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err));
141 DestroyContext(&ctx);
142 return 1;
143 }
144
145 /* ---------------------------------------------------------------------- */
146 /* open file */
147 #if defined(_WIN32)
148 if (!displaystdout)
149 file = fopen("visualinfo.txt", "w");
150 if (file == NULL)
151 file = stdout;
152 #else
153 file = stdout;
154 #endif
155
156 /* ---------------------------------------------------------------------- */
157 /* output header information */
158 /* OpenGL extensions */
159 fprintf(file, "OpenGL vendor string: %s\n", glGetString(GL_VENDOR));
160 fprintf(file, "OpenGL renderer string: %s\n", glGetString(GL_RENDERER));
161 fprintf(file, "OpenGL version string: %s\n", glGetString(GL_VERSION));
162 fprintf(file, "OpenGL extensions (GL_): \n");
163 PrintExtensions((char*)glGetString(GL_EXTENSIONS));
164 /* GLU extensions */
165 fprintf(file, "GLU version string: %s\n", gluGetString(GLU_VERSION));
166 fprintf(file, "GLU extensions (GLU_): \n");
167 PrintExtensions((char*)gluGetString(GLU_EXTENSIONS));
168
169 /* ---------------------------------------------------------------------- */
170 /* extensions string */
171 #if defined(_WIN32)
172 /* WGL extensions */
173 if (WGLEW_ARB_extensions_string || WGLEW_EXT_extensions_string)
174 {
175 fprintf(file, "WGL extensions (WGL_): \n");
176 PrintExtensions(wglGetExtensionsStringARB ?
177 (char*)wglGetExtensionsStringARB(ctx.dc) :
178 (char*)wglGetExtensionsStringEXT());
179 }
180 #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
181
182 #else
183 /* GLX extensions */
184 fprintf(file, "GLX extensions (GLX_): \n");
185 PrintExtensions(glXQueryExtensionsString(glXGetCurrentDisplay(),
186 DefaultScreen(glXGetCurrentDisplay())));
187 #endif
188
189 /* ---------------------------------------------------------------------- */
190 /* enumerate all the formats */
191 VisualInfo(&ctx);
192
193 /* ---------------------------------------------------------------------- */
194 /* release resources */
195 DestroyContext(&ctx);
196 if (file != stdout)
197 fclose(file);
198 return 0;
199 }
200
201 /* do the magic to separate all extensions with comma's, except
202 for the last one that _may_ terminate in a space. */
203 void PrintExtensions (const char* s)
204 {
205 char t[80];
206 int i=0;
207 char* p=0;
208
209 t[79] = '\0';
210 while (*s)
211 {
212 t[i++] = *s;
213 if(*s == ' ')
214 {
215 if (*(s+1) != '\0') {
216 t[i-1] = ',';
217 t[i] = ' ';
218 p = &t[i++];
219 }
220 else /* zoinks! last one terminated in a space! */
221 {
222 t[i-1] = '\0';
223 }
224 }
225 if(i > 80 - 5)
226 {
227 *p = t[i] = '\0';
228 fprintf(file, " %s\n", t);
229 p++;
230 i = (int)strlen(p);
231 strcpy(t, p);
232 }
233 s++;
234 }
235 t[i] = '\0';
236 fprintf(file, " %s.\n", t);
237 }
238
239 /* ---------------------------------------------------------------------- */
240
241 #if defined(_WIN32)
242
243 void
244 VisualInfoARB (GLContext* ctx)
245 {
246 int attrib[32], value[32], n_attrib, n_pbuffer=0, n_float=0;
247 int i, pf, maxpf;
248 unsigned int c;
249
250 /* to get pbuffer capable pixel formats */
251 attrib[0] = WGL_DRAW_TO_PBUFFER_ARB;
252 attrib[1] = GL_TRUE;
253 attrib[2] = 0;
254 wglChoosePixelFormatARB(ctx->dc, attrib, 0, 1, &pf, &c);
255 /* query number of pixel formats */
256 attrib[0] = WGL_NUMBER_PIXEL_FORMATS_ARB;
257 wglGetPixelFormatAttribivARB(ctx->dc, 0, 0, 1, attrib, value);
258 maxpf = value[0];
259 for (i=0; i<32; i++)
260 value[i] = 0;
261
262 attrib[0] = WGL_SUPPORT_OPENGL_ARB;
263 attrib[1] = WGL_DRAW_TO_WINDOW_ARB;
264 attrib[2] = WGL_DRAW_TO_BITMAP_ARB;
265 attrib[3] = WGL_ACCELERATION_ARB;
266 /* WGL_NO_ACCELERATION_ARB, WGL_GENERIC_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB */
267 attrib[4] = WGL_SWAP_METHOD_ARB;
268 /* WGL_SWAP_EXCHANGE_ARB, WGL_SWAP_COPY_ARB, WGL_SWAP_UNDEFINED_ARB */
269 attrib[5] = WGL_DOUBLE_BUFFER_ARB;
270 attrib[6] = WGL_STEREO_ARB;
271 attrib[7] = WGL_PIXEL_TYPE_ARB;
272 /* WGL_TYPE_RGBA_ARB, WGL_TYPE_COLORINDEX_ARB,
273 WGL_TYPE_RGBA_FLOAT_ATI (WGL_ATI_pixel_format_float) */
274 /* Color buffer information */
275 attrib[8] = WGL_COLOR_BITS_ARB;
276 attrib[9] = WGL_RED_BITS_ARB;
277 attrib[10] = WGL_GREEN_BITS_ARB;
278 attrib[11] = WGL_BLUE_BITS_ARB;
279 attrib[12] = WGL_ALPHA_BITS_ARB;
280 /* Accumulation buffer information */
281 attrib[13] = WGL_ACCUM_BITS_ARB;
282 attrib[14] = WGL_ACCUM_RED_BITS_ARB;
283 attrib[15] = WGL_ACCUM_GREEN_BITS_ARB;
284 attrib[16] = WGL_ACCUM_BLUE_BITS_ARB;
285 attrib[17] = WGL_ACCUM_ALPHA_BITS_ARB;
286 /* Depth, stencil, and aux buffer information */
287 attrib[18] = WGL_DEPTH_BITS_ARB;
288 attrib[19] = WGL_STENCIL_BITS_ARB;
289 attrib[20] = WGL_AUX_BUFFERS_ARB;
290 /* Layer information */
291 attrib[21] = WGL_NUMBER_OVERLAYS_ARB;
292 attrib[22] = WGL_NUMBER_UNDERLAYS_ARB;
293 attrib[23] = WGL_SWAP_LAYER_BUFFERS_ARB;
294 attrib[24] = WGL_SAMPLES_ARB;
295 attrib[25] = WGL_SUPPORT_GDI_ARB;
296 n_attrib = 26;
297 if (WGLEW_ARB_pbuffer)
298 {
299 attrib[n_attrib] = WGL_DRAW_TO_PBUFFER_ARB;
300 n_pbuffer = n_attrib;
301 n_attrib++;
302 }
303 if (WGLEW_NV_float_buffer)
304 {
305 attrib[n_attrib] = WGL_FLOAT_COMPONENTS_NV;
306 n_float = n_attrib;
307 n_attrib++;
308 }
309
310 if (!verbose)
311 {
312 /* print table header */
313 fprintf(file, " +-----+-------------------------+-----------------+----------+-----------------+----------+\n");
314 fprintf(file, " | | visual | color | ax dp st | accum | layer |\n");
315 fprintf(file, " | id | tp ac gd fm db sw st ms | sz r g b a | bf th cl | sz r g b a | ov un sw |\n");
316 fprintf(file, " +-----+-------------------------+-----------------+----------+-----------------+----------+\n");
317 /* loop through all the pixel formats */
318 for(i = 1; i <= maxpf; i++)
319 {
320 wglGetPixelFormatAttribivARB(ctx->dc, i, 0, n_attrib, attrib, value);
321 /* only describe this format if it supports OpenGL */
322 if (!value[0]) continue;
323 /* by default show only fully accelerated window or pbuffer capable visuals */
324 if (!showall
325 && ((value[2] && !value[1])
326 || (!WGLEW_ARB_pbuffer || !value[n_pbuffer])
327 || (value[3] != WGL_FULL_ACCELERATION_ARB))) continue;
328 /* print out the information for this visual */
329 /* visual id */
330 fprintf(file, " |% 4d | ", i);
331 /* visual type */
332 if (value[1])
333 {
334 if (WGLEW_ARB_pbuffer && value[n_pbuffer]) fprintf(file, "wp ");
335 else fprintf(file, "wn ");
336 }
337 else
338 {
339 if (value[2]) fprintf(file, "bm ");
340 else if (WGLEW_ARB_pbuffer && value[n_pbuffer]) fprintf(file, "pb ");
341 }
342 /* acceleration */
343 fprintf(file, "%s ", value[3] == WGL_FULL_ACCELERATION_ARB ? "fu" :
344 value[3] == WGL_GENERIC_ACCELERATION_ARB ? "ge" :
345 value[3] == WGL_NO_ACCELERATION_ARB ? "no" : ". ");
346 /* gdi support */
347 fprintf(file, " %c ", value[25] ? 'y' : '.');
348 /* format */
349 if (WGLEW_NV_float_buffer && value[n_float]) fprintf(file, " f ");
350 else if (WGLEW_ATI_pixel_format_float && value[7] == WGL_TYPE_RGBA_FLOAT_ATI) fprintf(file, " f ");
351 else if (value[7] == WGL_TYPE_RGBA_ARB) fprintf(file, " i ");
352 else if (value[7] == WGL_TYPE_COLORINDEX_ARB) fprintf(file, " c ");
353 /* double buffer */
354 fprintf(file, " %c ", value[5] ? 'y' : '.');
355 /* swap method */
356 if (value[4] == WGL_SWAP_EXCHANGE_ARB) fprintf(file, " x ");
357 else if (value[4] == WGL_SWAP_COPY_ARB) fprintf(file, " c ");
358 else if (value[4] == WGL_SWAP_UNDEFINED_ARB) fprintf(file, " . ");
359 else fprintf(file, " . ");
360 /* stereo */
361 fprintf(file, " %c ", value[6] ? 'y' : '.');
362 /* multisample */
363 if (value[24] > 0)
364 fprintf(file, "%2d | ", value[24]);
365 else
366 fprintf(file, " . | ");
367 /* color size */
368 if (value[8]) fprintf(file, "%3d ", value[8]);
369 else fprintf(file, " . ");
370 /* red */
371 if (value[9]) fprintf(file, "%2d ", value[9]);
372 else fprintf(file, " . ");
373 /* green */
374 if (value[10]) fprintf(file, "%2d ", value[10]);
375 else fprintf(file, " . ");
376 /* blue */
377 if (value[11]) fprintf(file, "%2d ", value[11]);
378 else fprintf(file, " . ");
379 /* alpha */
380 if (value[12]) fprintf(file, "%2d | ", value[12]);
381 else fprintf(file, " . | ");
382 /* aux buffers */
383 if (value[20]) fprintf(file, "%2d ", value[20]);
384 else fprintf(file, " . ");
385 /* depth */
386 if (value[18]) fprintf(file, "%2d ", value[18]);
387 else fprintf(file, " . ");
388 /* stencil */
389 if (value[19]) fprintf(file, "%2d | ", value[19]);
390 else fprintf(file, " . | ");
391 /* accum size */
392 if (value[13]) fprintf(file, "%3d ", value[13]);
393 else fprintf(file, " . ");
394 /* accum red */
395 if (value[14]) fprintf(file, "%2d ", value[14]);
396 else fprintf(file, " . ");
397 /* accum green */
398 if (value[15]) fprintf(file, "%2d ", value[15]);
399 else fprintf(file, " . ");
400 /* accum blue */
401 if (value[16]) fprintf(file, "%2d ", value[16]);
402 else fprintf(file, " . ");
403 /* accum alpha */
404 if (value[17]) fprintf(file, "%2d | ", value[17]);
405 else fprintf(file, " . | ");
406 /* overlay */
407 if (value[21]) fprintf(file, "%2d ", value[21]);
408 else fprintf(file, " . ");
409 /* underlay */
410 if (value[22]) fprintf(file, "%2d ", value[22]);
411 else fprintf(file, " . ");
412 /* layer swap */
413 if (value[23]) fprintf(file, "y ");
414 else fprintf(file, " . ");
415 fprintf(file, "|\n");
416 }
417 /* print table footer */
418 fprintf(file, " +-----+-------------------------+-----------------+----------+-----------------+----------+\n");
419 fprintf(file, " | | visual | color | ax dp st | accum | layer |\n");
420 fprintf(file, " | id | tp ac gd fm db sw st ms | sz r g b a | bf th cl | sz r g b a | ov un sw |\n");
421 fprintf(file, " +-----+-------------------------+-----------------+----------+-----------------+----------+\n");
422 }
423 else /* verbose */
424 {
425 #if 0
426 fprintf(file, "\n");
427 /* loop through all the pixel formats */
428 for(i = 1; i <= maxpf; i++)
429 {
430 DescribePixelFormat(ctx->dc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
431 /* only describe this format if it supports OpenGL */
432 if(!(pfd.dwFlags & PFD_SUPPORT_OPENGL)
433 || (drawableonly && !(pfd.dwFlags & PFD_DRAW_TO_WINDOW))) continue;
434 fprintf(file, "Visual ID: %2d depth=%d class=%s\n", i, pfd.cDepthBits,
435 pfd.cColorBits <= 8 ? "PseudoColor" : "TrueColor");
436 fprintf(file, " bufferSize=%d level=%d renderType=%s doubleBuffer=%d stereo=%d\n", pfd.cColorBits, pfd.bReserved, pfd.iPixelType == PFD_TYPE_RGBA ? "rgba" : "ci", pfd.dwFlags & PFD_DOUBLEBUFFER, pfd.dwFlags & PFD_STEREO);
437 fprintf(file, " generic=%d generic accelerated=%d\n", (pfd.dwFlags & PFD_GENERIC_FORMAT) == PFD_GENERIC_FORMAT, (pfd.dwFlags & PFD_GENERIC_ACCELERATED) == PFD_GENERIC_ACCELERATED);
438 fprintf(file, " rgba: redSize=%d greenSize=%d blueSize=%d alphaSize=%d\n", pfd.cRedBits, pfd.cGreenBits, pfd.cBlueBits, pfd.cAlphaBits);
439 fprintf(file, " auxBuffers=%d depthSize=%d stencilSize=%d\n", pfd.cAuxBuffers, pfd.cDepthBits, pfd.cStencilBits);
440 fprintf(file, " accum: redSize=%d greenSize=%d blueSize=%d alphaSize=%d\n", pfd.cAccumRedBits, pfd.cAccumGreenBits, pfd.cAccumBlueBits, pfd.cAccumAlphaBits);
441 fprintf(file, " multiSample=%d multisampleBuffers=%d\n", 0, 0);
442 fprintf(file, " Opaque.\n");
443 }
444 #endif
445 }
446 }
447
448 void
449 VisualInfoGDI (GLContext* ctx)
450 {
451 int i, maxpf;
452 PIXELFORMATDESCRIPTOR pfd;
453
454 /* calling DescribePixelFormat() with NULL pfd (!!!) return maximum
455 number of pixel formats */
456 maxpf = DescribePixelFormat(ctx->dc, 1, 0, NULL);
457
458 if (!verbose)
459 {
460 fprintf(file, "-----------------------------------------------------------------------------\n");
461 fprintf(file, " visual x bf lv rg d st ge ge r g b a ax dp st accum buffs ms \n");
462 fprintf(file, " id dep tp sp sz l ci b ro ne ac sz sz sz sz bf th cl sz r g b a ns b\n");
463 fprintf(file, "-----------------------------------------------------------------------------\n");
464
465 /* loop through all the pixel formats */
466 for(i = 1; i <= maxpf; i++)
467 {
468 DescribePixelFormat(ctx->dc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
469 /* only describe this format if it supports OpenGL */
470 if(!(pfd.dwFlags & PFD_SUPPORT_OPENGL)
471 || (drawableonly && (pfd.dwFlags & PFD_DRAW_TO_BITMAP))) continue;
472 /* other criteria could be tested here for actual pixel format
473 choosing in an application:
474
475 for (...each pixel format...) {
476 if (pfd.dwFlags & PFD_SUPPORT_OPENGL &&
477 pfd.dwFlags & PFD_DOUBLEBUFFER &&
478 pfd.cDepthBits >= 24 &&
479 pfd.cColorBits >= 24)
480 {
481 goto found;
482 }
483 }
484 ... not found so exit ...
485 found:
486 ... found so use it ...
487 */
488 /* print out the information for this pixel format */
489 fprintf(file, "0x%02x ", i);
490 fprintf(file, "%3d ", pfd.cColorBits);
491 if(pfd.dwFlags & PFD_DRAW_TO_WINDOW) fprintf(file, "wn ");
492 else if(pfd.dwFlags & PFD_DRAW_TO_BITMAP) fprintf(file, "bm ");
493 else fprintf(file, "pb ");
494 /* should find transparent pixel from LAYERPLANEDESCRIPTOR */
495 fprintf(file, " . ");
496 fprintf(file, "%3d ", pfd.cColorBits);
497 /* bReserved field indicates number of over/underlays */
498 if(pfd.bReserved) fprintf(file, " %d ", pfd.bReserved);
499 else fprintf(file, " . ");
500 fprintf(file, " %c ", pfd.iPixelType == PFD_TYPE_RGBA ? 'r' : 'c');
501 fprintf(file, "%c ", pfd.dwFlags & PFD_DOUBLEBUFFER ? 'y' : '.');
502 fprintf(file, " %c ", pfd.dwFlags & PFD_STEREO ? 'y' : '.');
503 /* added: */
504 fprintf(file, " %c ", pfd.dwFlags & PFD_GENERIC_FORMAT ? 'y' : '.');
505 fprintf(file, " %c ", pfd.dwFlags & PFD_GENERIC_ACCELERATED ? 'y' : '.');
506 if(pfd.cRedBits && pfd.iPixelType == PFD_TYPE_RGBA)
507 fprintf(file, "%2d ", pfd.cRedBits);
508 else fprintf(file, " . ");
509 if(pfd.cGreenBits && pfd.iPixelType == PFD_TYPE_RGBA)
510 fprintf(file, "%2d ", pfd.cGreenBits);
511 else fprintf(file, " . ");
512 if(pfd.cBlueBits && pfd.iPixelType == PFD_TYPE_RGBA)
513 fprintf(file, "%2d ", pfd.cBlueBits);
514 else fprintf(file, " . ");
515 if(pfd.cAlphaBits && pfd.iPixelType == PFD_TYPE_RGBA)
516 fprintf(file, "%2d ", pfd.cAlphaBits);
517 else fprintf(file, " . ");
518 if(pfd.cAuxBuffers) fprintf(file, "%2d ", pfd.cAuxBuffers);
519 else fprintf(file, " . ");
520 if(pfd.cDepthBits) fprintf(file, "%2d ", pfd.cDepthBits);
521 else fprintf(file, " . ");
522 if(pfd.cStencilBits) fprintf(file, "%2d ", pfd.cStencilBits);
523 else fprintf(file, " . ");
524 if(pfd.cAccumBits) fprintf(file, "%3d ", pfd.cAccumBits);
525 else fprintf(file, " . ");
526 if(pfd.cAccumRedBits) fprintf(file, "%2d ", pfd.cAccumRedBits);
527 else fprintf(file, " . ");
528 if(pfd.cAccumGreenBits) fprintf(file, "%2d ", pfd.cAccumGreenBits);
529 else fprintf(file, " . ");
530 if(pfd.cAccumBlueBits) fprintf(file, "%2d ", pfd.cAccumBlueBits);
531 else fprintf(file, " . ");
532 if(pfd.cAccumAlphaBits) fprintf(file, "%2d ", pfd.cAccumAlphaBits);
533 else fprintf(file, " . ");
534 /* no multisample in win32 */
535 fprintf(file, " . .\n");
536 }
537 /* print table footer */
538 fprintf(file, "-----------------------------------------------------------------------------\n");
539 fprintf(file, " visual x bf lv rg d st ge ge r g b a ax dp st accum buffs ms \n");
540 fprintf(file, " id dep tp sp sz l ci b ro ne ac sz sz sz sz bf th cl sz r g b a ns b\n");
541 fprintf(file, "-----------------------------------------------------------------------------\n");
542 }
543 else /* verbose */
544 {
545 fprintf(file, "\n");
546 /* loop through all the pixel formats */
547 for(i = 1; i <= maxpf; i++)
548 {
549 DescribePixelFormat(ctx->dc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
550 /* only describe this format if it supports OpenGL */
551 if(!(pfd.dwFlags & PFD_SUPPORT_OPENGL)
552 || (drawableonly && !(pfd.dwFlags & PFD_DRAW_TO_WINDOW))) continue;
553 fprintf(file, "Visual ID: %2d depth=%d class=%s\n", i, pfd.cDepthBits,
554 pfd.cColorBits <= 8 ? "PseudoColor" : "TrueColor");
555 fprintf(file, " bufferSize=%d level=%d renderType=%s doubleBuffer=%ld stereo=%ld\n", pfd.cColorBits, pfd.bReserved, pfd.iPixelType == PFD_TYPE_RGBA ? "rgba" : "ci", pfd.dwFlags & PFD_DOUBLEBUFFER, pfd.dwFlags & PFD_STEREO);
556 fprintf(file, " generic=%d generic accelerated=%d\n", (pfd.dwFlags & PFD_GENERIC_FORMAT) == PFD_GENERIC_FORMAT, (pfd.dwFlags & PFD_GENERIC_ACCELERATED) == PFD_GENERIC_ACCELERATED);
557 fprintf(file, " rgba: redSize=%d greenSize=%d blueSize=%d alphaSize=%d\n", pfd.cRedBits, pfd.cGreenBits, pfd.cBlueBits, pfd.cAlphaBits);
558 fprintf(file, " auxBuffers=%d depthSize=%d stencilSize=%d\n", pfd.cAuxBuffers, pfd.cDepthBits, pfd.cStencilBits);
559 fprintf(file, " accum: redSize=%d greenSize=%d blueSize=%d alphaSize=%d\n", pfd.cAccumRedBits, pfd.cAccumGreenBits, pfd.cAccumBlueBits, pfd.cAccumAlphaBits);
560 fprintf(file, " multiSample=%d multisampleBuffers=%d\n", 0, 0);
561 fprintf(file, " Opaque.\n");
562 }
563 }
564 }
565
566 void
567 VisualInfo (GLContext* ctx)
568 {
569 if (WGLEW_ARB_pixel_format)
570 VisualInfoARB(ctx);
571 else
572 VisualInfoGDI(ctx);
573 }
574
575 /* ---------------------------------------------------------------------- */
576
577 #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
578
579 void
580 VisualInfo (GLContext* ctx)
581 {
582 /*
583 int attrib[] = { AGL_RGBA, AGL_NONE };
584 AGLPixelFormat pf;
585 GLint value;
586 pf = aglChoosePixelFormat(NULL, 0, attrib);
587 while (pf != NULL)
588 {
589 aglDescribePixelFormat(pf, GL_RGBA, &value);
590 fprintf(stderr, "%d\n", value);
591 pf = aglNextPixelFormat(pf);
592 }
593 */
594 }
595
596 #else /* GLX */
597
598 void
599 VisualInfo (GLContext* ctx)
600 {
601 int n_fbc;
602 GLXFBConfig* fbc;
603 int value, ret, i;
604
605 fbc = glXGetFBConfigs(ctx->dpy, DefaultScreen(ctx->dpy), &n_fbc);
606
607 if (fbc)
608 {
609 if (!verbose)
610 {
611 /* print table header */
612 fprintf(file, " +-----+-------------------------+-----------------+----------+-------------+-------+------+\n");
613 fprintf(file, " | | visual | color | ax dp st | accum | ms | cav |\n");
614 fprintf(file, " | id | tp xr cl fm db st lv xp | sz r g b a | bf th cl | r g b a | ns b | eat |\n");
615 fprintf(file, " +-----+-------------------------+-----------------+----------+-------------+-------+------+\n");
616 /* loop through all the fbcs */
617 for (i=0; i<n_fbc; i++)
618 {
619 /* print out the information for this fbc */
620 /* visual id */
621 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_FBCONFIG_ID, &value);
622 if (ret != Success)
623 {
624 fprintf(file, "| ? |");
625 }
626 else
627 {
628 fprintf(file, " |% 4d | ", value);
629 }
630 /* visual type */
631 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_DRAWABLE_TYPE, &value);
632 if (ret != Success)
633 {
634 fprintf(file, " ? ");
635 }
636 else
637 {
638 if (value & GLX_WINDOW_BIT)
639 {
640 if (value & GLX_PBUFFER_BIT)
641 {
642 fprintf(file, "wp ");
643 }
644 else
645 {
646 fprintf(file, "wn ");
647 }
648 }
649 else
650 {
651 if (value & GLX_PBUFFER_BIT)
652 {
653 fprintf(file, "pb ");
654 }
655 else if (value & GLX_PIXMAP_BIT)
656 {
657 fprintf(file, "pm ");
658 }
659 else
660 {
661 fprintf(file, " ? ");
662 }
663 }
664 }
665 /* x renderable */
666 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_X_RENDERABLE, &value);
667 if (ret != Success)
668 {
669 fprintf(file, " ? ");
670 }
671 else
672 {
673 fprintf(file, value ? " y " : " n ");
674 }
675 /* class */
676 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_X_VISUAL_TYPE, &value);
677 if (ret != Success)
678 {
679 fprintf(file, " ? ");
680 }
681 else
682 {
683 if (GLX_TRUE_COLOR == value)
684 fprintf(file, "tc ");
685 else if (GLX_DIRECT_COLOR == value)
686 fprintf(file, "dc ");
687 else if (GLX_PSEUDO_COLOR == value)
688 fprintf(file, "pc ");
689 else if (GLX_STATIC_COLOR == value)
690 fprintf(file, "sc ");
691 else if (GLX_GRAY_SCALE == value)
692 fprintf(file, "gs ");
693 else if (GLX_STATIC_GRAY == value)
694 fprintf(file, "sg ");
695 else if (GLX_X_VISUAL_TYPE == value)
696 fprintf(file, " . ");
697 else
698 fprintf(file, " ? ");
699 }
700 /* format */
701 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_RENDER_TYPE, &value);
702 if (ret != Success)
703 {
704 fprintf(file, " ? ");
705 }
706 else
707 {
708 if (GLXEW_NV_float_buffer)
709 {
710 int ret2, value2;
711 ret2 = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_FLOAT_COMPONENTS_NV, &value2);
712 if (Success == ret2 && GL_TRUE == value2)
713 {
714 fprintf(file, " f ");
715 }
716 else if (value & GLX_RGBA_BIT)
717 fprintf(file, " i ");
718 else if (value & GLX_COLOR_INDEX_BIT)
719 fprintf(file, " c ");
720 else
721 fprintf(file, " ? ");
722 }
723 else
724 {
725 if (value & GLX_RGBA_FLOAT_ATI_BIT)
726 fprintf(file, " f ");
727 else if (value & GLX_RGBA_BIT)
728 fprintf(file, " i ");
729 else if (value & GLX_COLOR_INDEX_BIT)
730 fprintf(file, " c ");
731 else
732 fprintf(file, " ? ");
733 }
734 }
735 /* double buffer */
736 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_DOUBLEBUFFER, &value);
737 fprintf(file, " %c ", Success != ret ? '?' : (value ? 'y' : '.'));
738 /* stereo */
739 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_STEREO, &value);
740 fprintf(file, " %c ", Success != ret ? '?' : (value ? 'y' : '.'));
741 /* level */
742 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_LEVEL, &value);
743 if (Success != ret)
744 {
745 fprintf(file, " ? ");
746 }
747 else
748 {
749 fprintf(file, "%2d ", value);
750 }
751 /* transparency */
752 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_TRANSPARENT_TYPE, &value);
753 if (Success != ret)
754 {
755 fprintf(file, " ? | ");
756 }
757 else
758 {
759 if (GLX_TRANSPARENT_RGB == value)
760 fprintf(file, " r | ");
761 else if (GLX_TRANSPARENT_INDEX == value)
762 fprintf(file, " i | ");
763 else if (GLX_NONE == value)
764 fprintf(file, " . | ");
765 else
766 fprintf(file, " ? | ");
767 }
768 /* color size */
769 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_BUFFER_SIZE, &value);
770 if (Success != ret)
771 {
772 fprintf(file, " ? ");
773 }
774 else
775 {
776 if (value)
777 fprintf(file, "%3d ", value);
778 else
779 fprintf(file, " . ");
780 }
781 /* red size */
782 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_RED_SIZE, &value);
783 if (Success != ret)
784 {
785 fprintf(file, " ? ");
786 }
787 else
788 {
789 if (value)
790 fprintf(file, "%2d ", value);
791 else
792 fprintf(file, " . ");
793 }
794 /* green size */
795 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_GREEN_SIZE, &value);
796 if (Success != ret)
797 {
798 fprintf(file, " ? ");
799 }
800 else
801 {
802 if (value)
803 fprintf(file, "%2d ", value);
804 else
805 fprintf(file, " . ");
806 }
807 /* blue size */
808 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_BLUE_SIZE, &value);
809 if (Success != ret)
810 {
811 fprintf(file, " ? ");
812 }
813 else
814 {
815 if (value)
816 fprintf(file, "%2d ", value);
817 else
818 fprintf(file, " . ");
819 }
820 /* alpha size */
821 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_ALPHA_SIZE, &value);
822 if (Success != ret)
823 {
824 fprintf(file, " ? | ");
825 }
826 else
827 {
828 if (value)
829 fprintf(file, "%2d | ", value);
830 else
831 fprintf(file, " . | ");
832 }
833 /* aux buffers */
834 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_AUX_BUFFERS, &value);
835 if (Success != ret)
836 {
837 fprintf(file, " ? ");
838 }
839 else
840 {
841 if (value)
842 fprintf(file, "%2d ", value);
843 else
844 fprintf(file, " . ");
845 }
846 /* depth size */
847 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_DEPTH_SIZE, &value);
848 if (Success != ret)
849 {
850 fprintf(file, " ? ");
851 }
852 else
853 {
854 if (value)
855 fprintf(file, "%2d ", value);
856 else
857 fprintf(file, " . ");
858 }
859 /* stencil size */
860 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_STENCIL_SIZE, &value);
861 if (Success != ret)
862 {
863 fprintf(file, " ? | ");
864 }
865 else
866 {
867 if (value)
868 fprintf(file, "%2d | ", value);
869 else
870 fprintf(file, " . | ");
871 }
872 /* accum red size */
873 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_ACCUM_RED_SIZE, &value);
874 if (Success != ret)
875 {
876 fprintf(file, " ? ");
877 }
878 else
879 {
880 if (value)
881 fprintf(file, "%2d ", value);
882 else
883 fprintf(file, " . ");
884 }
885 /* accum green size */
886 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_ACCUM_GREEN_SIZE, &value);
887 if (Success != ret)
888 {
889 fprintf(file, " ? ");
890 }
891 else
892 {
893 if (value)
894 fprintf(file, "%2d ", value);
895 else
896 fprintf(file, " . ");
897 }
898 /* accum blue size */
899 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_ACCUM_BLUE_SIZE, &value);
900 if (Success != ret)
901 {
902 fprintf(file, " ? ");
903 }
904 else
905 {
906 if (value)
907 fprintf(file, "%2d ", value);
908 else
909 fprintf(file, " . ");
910 }
911 /* accum alpha size */
912 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_ACCUM_ALPHA_SIZE, &value);
913 if (Success != ret)
914 {
915 fprintf(file, " ? | ");
916 }
917 else
918 {
919 if (value)
920 fprintf(file, "%2d | ", value);
921 else
922 fprintf(file, " . | ");
923 }
924 /* multisample */
925 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_SAMPLES, &value);
926 if (Success != ret)
927 {
928 fprintf(file, " ? ");
929 }
930 else
931 {
932 fprintf(file, "%2d ", value);
933 }
934 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_SAMPLE_BUFFERS, &value);
935 if (Success != ret)
936 {
937 fprintf(file, " ? | ");
938 }
939 else
940 {
941 fprintf(file, "%2d | ", value);
942 }
943 /* caveat */
944 ret = glXGetFBConfigAttrib(ctx->dpy, fbc[i], GLX_CONFIG_CAVEAT, &value);
945 if (Success != ret)
946 {
947 fprintf(file, "???? |");
948 }
949 else
950 {
951 if (GLX_NONE == value)
952 fprintf(file, "none |\n");
953 else if (GLX_SLOW_CONFIG == value)
954 fprintf(file, "slow |\n");
955 else if (GLX_NON_CONFORMANT_CONFIG == value)
956 fprintf(file, "ncft |\n");
957 else
958 fprintf(file, "???? |\n");
959 }
960 }
961 /* print table footer */
962 fprintf(file, " +-----+-------------------------+-----------------+----------+-------------+-------+------+\n");
963 fprintf(file, " | id | tp xr cl fm db st lv xp | sz r g b a | bf th cl | r g b a | ns b | eat |\n");
964 fprintf(file, " | | visual | color | ax dp st | accum | ms | cav |\n");
965 fprintf(file, " +-----+-------------------------+-----------------+----------+-------------+-------+------+\n");
966 }
967 }
968 }
969
970 #endif
971
972 /* ------------------------------------------------------------------------ */
973
974 #if defined(_WIN32)
975
976 void InitContext (GLContext* ctx)
977 {
978 ctx->wnd = NULL;
979 ctx->dc = NULL;
980 ctx->rc = NULL;
981 }
982
983 GLboolean CreateContext (GLContext* ctx)
984 {
985 WNDCLASS wc;
986 PIXELFORMATDESCRIPTOR pfd;
987 /* check for input */
988 if (NULL == ctx) return GL_TRUE;
989 /* register window class */
990 ZeroMemory(&wc, sizeof(WNDCLASS));
991 wc.hInstance = GetModuleHandle(NULL);
992 wc.lpfnWndProc = DefWindowProc;
993 wc.lpszClassName = "GLEW";
994 if (0 == RegisterClass(&wc)) return GL_TRUE;
995 /* create window */
996 ctx->wnd = CreateWindow("GLEW", "GLEW", 0, CW_USEDEFAULT, CW_USEDEFAULT,
997 CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL,
998 GetModuleHandle(NULL), NULL);
999 if (NULL == ctx->wnd) return GL_TRUE;
1000 /* get the device context */
1001 ctx->dc = GetDC(ctx->wnd);
1002 if (NULL == ctx->dc) return GL_TRUE;
1003 /* find pixel format */
1004 ZeroMemory(&pfd, sizeof(PIXELFORMATDESCRIPTOR));
1005 if (visual == -1) /* find default */
1006 {
1007 pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
1008 pfd.nVersion = 1;
1009 pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
1010 visual = ChoosePixelFormat(ctx->dc, &pfd);
1011 if (0 == visual) return GL_TRUE;
1012 }
1013 /* set the pixel format for the dc */
1014 if (FALSE == SetPixelFormat(ctx->dc, visual, &pfd)) return GL_TRUE;
1015 /* create rendering context */
1016 ctx->rc = wglCreateContext(ctx->dc);
1017 if (NULL == ctx->rc) return GL_TRUE;
1018 if (FALSE == wglMakeCurrent(ctx->dc, ctx->rc)) return GL_TRUE;
1019 return GL_FALSE;
1020 }
1021
1022 void DestroyContext (GLContext* ctx)
1023 {
1024 if (NULL == ctx) return;
1025 if (NULL != ctx->rc) wglMakeCurrent(NULL, NULL);
1026 if (NULL != ctx->rc) wglDeleteContext(wglGetCurrentContext());
1027 if (NULL != ctx->wnd && NULL != ctx->dc) ReleaseDC(ctx->wnd, ctx->dc);
1028 if (NULL != ctx->wnd) DestroyWindow(ctx->wnd);
1029 UnregisterClass("GLEW", GetModuleHandle(NULL));
1030 }
1031
1032 /* ------------------------------------------------------------------------ */
1033
1034 #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
1035
1036 void InitContext (GLContext* ctx)
1037 {
1038 ctx->ctx = NULL;
1039 ctx->octx = NULL;
1040 }
1041
1042 GLboolean CreateContext (GLContext* ctx)
1043 {
1044 int attrib[] = { AGL_RGBA, AGL_NONE };
1045 AGLPixelFormat pf;
1046 /* check input */
1047 if (NULL == ctx) return GL_TRUE;
1048 /*int major, minor;
1049 SetPortWindowPort(wnd);
1050 aglGetVersion(&major, &minor);
1051 fprintf(stderr, "GL %d.%d\n", major, minor);*/
1052 pf = aglChoosePixelFormat(NULL, 0, attrib);
1053 if (NULL == pf) return GL_TRUE;
1054 ctx->ctx = aglCreateContext(pf, NULL);
1055 if (NULL == ctx->ctx || AGL_NO_ERROR != aglGetError()) return GL_TRUE;
1056 aglDestroyPixelFormat(pf);
1057 /*aglSetDrawable(ctx, GetWindowPort(wnd));*/
1058 ctx->octx = aglGetCurrentContext();
1059 if (NULL == aglSetCurrentContext(ctx->ctx)) return GL_TRUE;
1060 return GL_FALSE;
1061 }
1062
1063 void DestroyContext (GLContext* ctx)
1064 {
1065 if (NULL == ctx) return;
1066 aglSetCurrentContext(ctx->octx);
1067 if (NULL != ctx->ctx) aglDestroyContext(ctx->ctx);
1068 }
1069
1070 /* ------------------------------------------------------------------------ */
1071
1072 #else /* __UNIX || (__APPLE__ && GLEW_APPLE_GLX) */
1073
1074 void InitContext (GLContext* ctx)
1075 {
1076 ctx->dpy = NULL;
1077 ctx->vi = NULL;
1078 ctx->ctx = NULL;
1079 ctx->wnd = 0;
1080 ctx->cmap = 0;
1081 }
1082
1083 GLboolean CreateContext (GLContext* ctx)
1084 {
1085 int attrib[] = { GLX_RGBA, GLX_DOUBLEBUFFER, None };
1086 int erb, evb;
1087 XSetWindowAttributes swa;
1088 /* check input */
1089 if (NULL == ctx) return GL_TRUE;
1090 /* open display */
1091 ctx->dpy = XOpenDisplay(display);
1092 if (NULL == ctx->dpy) return GL_TRUE;
1093 /* query for glx */
1094 if (!glXQueryExtension(ctx->dpy, &erb, &evb)) return GL_TRUE;
1095 /* choose visual */
1096 ctx->vi = glXChooseVisual(ctx->dpy, DefaultScreen(ctx->dpy), attrib);
1097 if (NULL == ctx->vi) return GL_TRUE;
1098 /* create context */
1099 ctx->ctx = glXCreateContext(ctx->dpy, ctx->vi, None, True);
1100 if (NULL == ctx->ctx) return GL_TRUE;
1101 /* create window */
1102 /*wnd = XCreateSimpleWindow(dpy, RootWindow(dpy, vi->screen), 0, 0, 1, 1, 1, 0, 0);*/
1103 ctx->cmap = XCreateColormap(ctx->dpy, RootWindow(ctx->dpy, ctx->vi->screen),
1104 ctx->vi->visual, AllocNone);
1105 swa.border_pixel = 0;
1106 swa.colormap = ctx->cmap;
1107 ctx->wnd = XCreateWindow(ctx->dpy, RootWindow(ctx->dpy, ctx->vi->screen),
1108 0, 0, 1, 1, 0, ctx->vi->depth, InputOutput, ctx->vi->visual,
1109 CWBorderPixel | CWColormap, &swa);
1110 /* make context current */
1111 if (!glXMakeCurrent(ctx->dpy, ctx->wnd, ctx->ctx)) return GL_TRUE;
1112 return GL_FALSE;
1113 }
1114
1115 void DestroyContext (GLContext* ctx)
1116 {
1117 if (NULL != ctx->dpy && NULL != ctx->ctx) glXDestroyContext(ctx->dpy, ctx->ctx);
1118 if (NULL != ctx->dpy && 0 != ctx->wnd) XDestroyWindow(ctx->dpy, ctx->wnd);
1119 if (NULL != ctx->dpy && 0 != ctx->cmap) XFreeColormap(ctx->dpy, ctx->cmap);
1120 if (NULL != ctx->vi) XFree(ctx->vi);
1121 if (NULL != ctx->dpy) XCloseDisplay(ctx->dpy);
1122 }
1123
1124 #endif /* __UNIX || (__APPLE__ && GLEW_APPLE_GLX) */
1125
1126 GLboolean ParseArgs (int argc, char** argv)
1127 {
1128 int p = 0;
1129 while (p < argc)
1130 {
1131 #if defined(_WIN32)
1132 if (!strcmp(argv[p], "-pf") || !strcmp(argv[p], "-pixelformat"))
1133 {
1134 if (++p >= argc) return GL_TRUE;
1135 display = NULL;
1136 visual = strtol(argv[p], NULL, 0);
1137 }
1138 else if (!strcmp(argv[p], "-a"))
1139 {
1140 showall = 1;
1141 }
1142 else if (!strcmp(argv[p], "-s"))
1143 {
1144 displaystdout = 1;
1145 }
1146 else if (!strcmp(argv[p], "-h"))
1147 {
1148 return GL_TRUE;
1149 }
1150 else
1151 return GL_TRUE;
1152 #else
1153 if (!strcmp(argv[p], "-display"))
1154 {
1155 if (++p >= argc) return GL_TRUE;
1156 display = argv[p];
1157 }
1158 else if (!strcmp(argv[p], "-visual"))
1159 {
1160 if (++p >= argc) return GL_TRUE;
1161 visual = (int)strtol(argv[p], NULL, 0);
1162 }
1163 else if (!strcmp(argv[p], "-h"))
1164 {
1165 return GL_TRUE;
1166 }
1167 else
1168 return GL_TRUE;
1169 #endif
1170 p++;
1171 }
1172 return GL_FALSE;
1173 }