aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--samples/OpenGL/x11argb_opengl/x11argb_opengl.c12
1 files changed, 12 insertions, 0 deletions
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);