From 06700e62bf32b64a7790ff7da1f3d306dd8c5500 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 19 Aug 2012 02:21:47 +0200 Subject: [PATCH] Don't call OpenGL functions until there's a context. --- tests/events.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/events.c b/tests/events.c index f82b8fc9..809da473 100644 --- a/tests/events.c +++ b/tests/events.c @@ -242,8 +242,11 @@ static void window_refresh_callback(GLFWwindow window) { printf("%08x at %0.3f: Window refresh\n", counter++, glfwGetTime()); - glClear(GL_COLOR_BUFFER_BIT); - glfwSwapBuffers(window); + if (glfwGetCurrentContext()) + { + glClear(GL_COLOR_BUFFER_BIT); + glfwSwapBuffers(window); + } } static void window_focus_callback(GLFWwindow window, int activated)