10
int main (int argc, char **argv)
12
Display *dpy = XOpenDisplay (NULL);
15
int attribSingle[] = {
22
int attribDouble[] = {
30
XSetWindowAttributes attr;
32
GLXContext ctx = NULL;
35
int exit_status = EXIT_SUCCESS;
37
GLint max_texture_size = 0;
40
/* We have, for some reason, been unable to connect to X
41
* Bail cleanly, and leave a little note */
42
fprintf (stderr, "check_gl_texture_size: Unable to open display %s", getenv("DISPLAY"));
46
visinfo = glXChooseVisual (dpy, DefaultScreen (dpy), attribSingle);
48
visinfo = glXChooseVisual (dpy, DefaultScreen (dpy), attribDouble);
51
ctx = glXCreateContext (dpy, visinfo, NULL, GL_TRUE);
54
exit_status = EXIT_FAILURE;
60
exit_status = EXIT_FAILURE;
64
attr.background_pixel = 0;
65
attr.border_pixel = 0;
66
attr.colormap = XCreateColormap (dpy, DefaultRootWindow (dpy),
67
visinfo->visual, AllocNone);
68
attr.event_mask = StructureNotifyMask | ExposureMask;
69
mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
70
win = XCreateWindow (dpy, DefaultRootWindow (dpy), 0, 0, 100, 100,
71
0, visinfo->depth, InputOutput,
72
visinfo->visual, mask, &attr);
74
if (!glXMakeCurrent (dpy, win, ctx)) {
75
exit_status = EXIT_FAILURE;
79
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &max_texture_size);
81
printf ("%u", max_texture_size);