From ba01e888fb6feb291e8eaa84c5abc8a8ed3c7d71 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sat, 3 Jul 2004 17:06:56 +0000 Subject: [PATCH] *** empty log message *** --- src/native/win32/org_lwjgl_opengl_Display.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/native/win32/org_lwjgl_opengl_Display.cpp b/src/native/win32/org_lwjgl_opengl_Display.cpp index 3dc5ab04..80b2267b 100644 --- a/src/native/win32/org_lwjgl_opengl_Display.cpp +++ b/src/native/win32/org_lwjgl_opengl_Display.cpp @@ -260,6 +260,7 @@ static void closeWindow() if (hdc != NULL && hwnd != NULL) { printfDebug("Releasing DC\n"); ReleaseDC(hwnd, hdc); + hdc = NULL; } // Close the window @@ -719,10 +720,20 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_createContext(JNIEnv *env, pixel_format_index = findPixelFormatARB(env, pixel_format, NULL, true, true, true); wglMakeCurrent(NULL, NULL); wglDeleteContext(hglrc); + closeWindow(); if (pixel_format_index == -1) { extgl_Close(); return; } + if (!createWindow(env, 1, 1, false, false)) { + extgl_Close(); + return; + } + if (!applyPixelFormat(env, hdc, pixel_format_index)) { + closeWindow(); + extgl_Close(); + return; + } hglrc = wglCreateContext(hdc); closeWindow(); if (hglrc == NULL) { @@ -740,7 +751,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_opengl_Display_destroyContext(JNIEnv *env, // Delete the rendering context if (hglrc != NULL) { printfDebug("Deleting GL context\n"); - wglDeleteContext(hglrc); + wglDeleteContext(hglrc); hglrc = NULL; } extgl_Close();