1 /* $Id: glxinfo.c,v 1.1 1999/09/16 16:40:46 brianp Exp $ */
5 * Query GLX extensions, version, vendor, etc.
6 * This program is in the public domain.
7 * brian_paul@mesa3d.org
21 query_glx( Display
*dpy
, int scr
)
23 printf("GL_VERSION: %s\n", (char *) glGetString(GL_VERSION
));
24 printf("GL_EXTENSIONS: %s\n", (char *) glGetString(GL_EXTENSIONS
));
25 printf("GL_RENDERER: %s\n", (char *) glGetString(GL_RENDERER
));
26 printf("GL_VENDOR: %s\n", (char *) glGetString(GL_VENDOR
));
27 printf("GLU_VERSION: %s\n", (char *) gluGetString(GLU_VERSION
));
28 printf("GLU_EXTENSIONS: %s\n", (char *) gluGetString(GLU_EXTENSIONS
));
30 printf("server GLX_VENDOR: %s\n", (char *) glXQueryServerString( dpy
, scr
, GLX_VENDOR
));
31 printf("server GLX_VERSION: %s\n", (char *) glXQueryServerString( dpy
, scr
, GLX_VERSION
));
32 printf("server GLX_EXTENSIONS: %s\n", (char *) glXQueryServerString( dpy
, scr
, GLX_EXTENSIONS
));
34 printf("client GLX_VENDOR: %s\n", (char *) glXGetClientString( dpy
, GLX_VENDOR
));
35 printf("client GLX_VERSION: %s\n", (char *) glXGetClientString( dpy
, GLX_VERSION
));
36 printf("client GLX_EXTENSIONS: %s\n", (char *) glXGetClientString( dpy
, GLX_EXTENSIONS
));
38 printf("GLX extensions: %s\n", (char *) glXQueryExtensionsString(dpy
, scr
));
45 main( int argc
, char *argv
[] )
49 int attrib
[] = { GLX_RGBA
,
55 XSetWindowAttributes attr
;
60 int width
= 100, height
= 100;
62 dpy
= XOpenDisplay(NULL
);
64 fprintf(stderr
, "Unable to open default display!\n");
68 scrnum
= DefaultScreen( dpy
);
69 root
= RootWindow( dpy
, scrnum
);
71 visinfo
= glXChooseVisual( dpy
, scrnum
, attrib
);
73 fprintf(stderr
, "Error: couldn't find RGB GLX visual!\n");
77 /* window attributes */
78 attr
.background_pixel
= 0;
79 attr
.border_pixel
= 0;
80 attr
.colormap
= XCreateColormap( dpy
, root
, visinfo
->visual
, AllocNone
);
81 attr
.event_mask
= StructureNotifyMask
| ExposureMask
;
82 mask
= CWBackPixel
| CWBorderPixel
| CWColormap
| CWEventMask
;
84 win
= XCreateWindow( dpy
, root
, 0, 0, width
, height
,
85 0, visinfo
->depth
, InputOutput
,
86 visinfo
->visual
, mask
, &attr
);
88 ctx
= glXCreateContext( dpy
, visinfo
, NULL
, True
);
90 glXMakeCurrent( dpy
, win
, ctx
);
92 query_glx(dpy
, scrnum
);
94 glXDestroyContext(dpy
, ctx
);
95 XDestroyWindow(dpy
, win
);