Skip to content

Instantly share code, notes, and snippets.

@yshui
Created February 3, 2019 14:41
Show Gist options
  • Save yshui/097e91c1d457ea00cf804f4d614da46c to your computer and use it in GitHub Desktop.
Save yshui/097e91c1d457ea00cf804f4d614da46c to your computer and use it in GitHub Desktop.
madness
// gcc glx.c -lX11 -lGL
#include <GL/glx.h>
#include <X11/Xlib.h>
#include <stdio.h>
int main() {
Display *dpy = XOpenDisplay(NULL);
int scr = DefaultScreen(dpy);
int ncfg;
GLXFBConfig *fbs = glXGetFBConfigs(dpy, scr, &ncfg);
for (int i = 0; i < ncfg; i++) {
int fbid, vid;
glXGetFBConfigAttrib(dpy, fbs[i], GLX_FBCONFIG_ID, &fbid);
glXGetFBConfigAttrib(dpy, fbs[i], GLX_VISUAL_ID, &vid);
printf("%lx %lx\n", fbid, vid);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment