summaryrefslogtreecommitdiff
path: root/ogl.c
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2012-11-07 21:01:31 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-11-07 22:00:29 +0000
commit45f7e04bb0f53223a5d05d93aa42b3faa6a97d76 (patch)
tree92e837e579092ffd55c0affb96a5f63d91a65ea8 /ogl.c
testcases
Diffstat (limited to 'ogl.c')
-rw-r--r--ogl.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/ogl.c b/ogl.c
new file mode 100644
index 0000000..3610050
--- /dev/null
+++ b/ogl.c
@@ -0,0 +1,27 @@
+/* gcc ogl.c -lGL -lX11 */
+/* fd.o bugzilla #8443 */
+
+#include <GL/glx.h>
+int main()
+{
+ Display *gdi_display = XOpenDisplay(NULL);
+ int screen = DefaultScreen(gdi_display);
+ Window win = RootWindow(gdi_display, screen);
+ Visual *visual;
+ XVisualInfo template;
+ XVisualInfo *vis;
+ int num;
+
+ GLXContext ctx = NULL;
+ visual = DefaultVisual(gdi_display, screen);
+ template.visualid = XVisualIDFromVisual(visual);
+ vis = XGetVisualInfo(gdi_display, VisualIDMask, &template, &num);
+ if (vis)
+ ctx = glXCreateContext(gdi_display, vis, None, GL_TRUE);
+ if (ctx)
+ glXMakeCurrent(gdi_display, win, ctx);
+ glXMakeCurrent(gdi_display, None, NULL);
+ XCloseDisplay(gdi_display);
+ return 0;
+}
+