From f5855968bb7379251bf35ae49802ce798a09807b Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Sun, 25 Oct 2015 00:35:16 +0200 Subject: [PATCH] Move glClear call to context module --- src/context.c | 9 ++++++++- src/internal.h | 1 - src/window.c | 5 ----- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/context.c b/src/context.c index 2f0b2bdf..e145ae35 100644 --- a/src/context.c +++ b/src/context.c @@ -357,7 +357,6 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig) window->GetIntegerv = (PFNGLGETINTEGERVPROC) glfwGetProcAddress("glGetIntegerv"); window->GetString = (PFNGLGETSTRINGPROC) glfwGetProcAddress("glGetString"); - window->Clear = (PFNGLCLEARPROC) glfwGetProcAddress("glClear"); if (!parseVersionString(&window->context.api, &window->context.major, @@ -470,6 +469,14 @@ GLFWbool _glfwRefreshContextAttribs(const _GLFWctxconfig* ctxconfig) window->context.release = GLFW_RELEASE_BEHAVIOR_FLUSH; } + // Clearing the front buffer to black to avoid garbage pixels left over from + // previous uses of our bit of VRAM + { + PFNGLCLEARPROC glClear = (PFNGLCLEARPROC) glfwGetProcAddress("glClear"); + glClear(GL_COLOR_BUFFER_BIT); + _glfwPlatformSwapBuffers(window); + } + return GLFW_TRUE; } diff --git a/src/internal.h b/src/internal.h index b551a008..2ee3e4b4 100644 --- a/src/internal.h +++ b/src/internal.h @@ -271,7 +271,6 @@ struct _GLFWwindow PFNGLGETSTRINGIPROC GetStringi; PFNGLGETINTEGERVPROC GetIntegerv; PFNGLGETSTRINGPROC GetString; - PFNGLCLEARPROC Clear; struct { GLFWwindowposfun pos; diff --git a/src/window.c b/src/window.c index 1b2e1f20..0e68742a 100644 --- a/src/window.c +++ b/src/window.c @@ -200,11 +200,6 @@ GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, return NULL; } - // Clearing the front buffer to black to avoid garbage pixels left over - // from previous uses of our bit of VRAM - window->Clear(GL_COLOR_BUFFER_BIT); - _glfwPlatformSwapBuffers(window); - // Restore the previously current context (or NULL) _glfwPlatformMakeContextCurrent(previous);