/* link with -lX11 -lGL */ #include #include #include #include #include #include #include int main() { Display *dpy; int major_opcode; int event_base; int error_base; xGLXCreateContextReq *req; dpy = XOpenDisplay(NULL); if (!dpy) { fprintf(stderr, "XOpenDisplay fail\n"); exit(1); } if (!XQueryExtension(dpy, GLX_EXTENSION_NAME, &major_opcode, &event_base, &error_base)) { fprintf(stderr, "no " GLX_EXTENSION_NAME " extension\n"); exit(1); } LockDisplay(dpy); GetReq(GLXCreateContext, req); req->reqType = major_opcode; req->glxCode = X_GLXCreateContext; req->context = XAllocID(dpy); req->visual = None; req->screen = -1000; req->shareList = None; req->isDirect = 0; UnlockDisplay(dpy); SyncHandle(); XCloseDisplay(dpy); exit(0); }