1 /* xscreensaver, Copyright (c) 2000 by Jamie Zawinski <jwz@jwz.org>
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
12 /* xscreensaver-gl-helper -- prints the ID of the best visual to use
13 for GL programs on stdout.
23 char *progclass = "XScreenSaver";
24 void *db = 0; /* hack hack -- no need for Xt in this program */
27 main (int argc, char **argv)
32 char *d = getenv ("DISPLAY");
36 for (i = 1; i < argc; i++)
38 if (argv[i][0] == '-' && argv[i][1] == '-') argv[i]++;
39 if (strlen(argv[i]) >= 2 &&
40 !strncmp ("-display", argv[i], strlen(argv[i])))
42 if (i == argc-1) goto LOSE;
49 fprintf (stderr, "usage: %s [ -display host:dpy.screen ]\n",
52 "This program prints out the ID of the best "
53 "X visual for GL programs to use.\n");
58 dpy = XOpenDisplay (d);
61 fprintf (stderr, "%s: couldn't open display %s\n", progname,
66 screen = DefaultScreenOfDisplay (dpy);
67 visual = get_gl_visual (screen);
70 printf ("0x%x\n", XVisualIDFromVisual (visual));