From eeb1931d2d214b28e4117ad17824ece40f865511 Mon Sep 17 00:00:00 2001 From: Wolfgang Draxinger Date: Thu, 5 Jan 2012 21:06:11 +0100 Subject: error handler added --- samples/OpenGL/x11argb_opengl/x11argb_opengl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'samples') diff --git a/samples/OpenGL/x11argb_opengl/x11argb_opengl.c b/samples/OpenGL/x11argb_opengl/x11argb_opengl.c index 77565f0..8eaddf8 100644 --- a/samples/OpenGL/x11argb_opengl/x11argb_opengl.c +++ b/samples/OpenGL/x11argb_opengl/x11argb_opengl.c @@ -246,6 +246,12 @@ static void createTheWindow() } } +static int ctxErrorHandler( Display *dpy, XErrorEvent *ev ) +{ + fputs("Error at context creation", stderr); + return 0; +} + static void createTheRenderContext() { int dummy; @@ -269,7 +275,13 @@ static void createTheRenderContext() None }; + int (*oldHandler)(Display*, XErrorEvent*) = XSetErrorHandler(&ctxErrorHandler); + render_context = glXCreateContextAttribsARB( Xdisplay, fbconfig, 0, True, context_attribs ); + + XSync( Xdisplay, False ); + XSetErrorHandler( oldHandler ); + fputs("glXCreateContextAttribsARB failed", stderr); } else { fputs("glXCreateContextAttribsARB could not be retrieved", stderr); -- cgit v1.2.3