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