From 7569ea6359793c6c8a977c97abbec02ad38e2173 Mon Sep 17 00:00:00 2001 From: Benjamin Doherty Date: Fri, 10 Aug 2018 10:23:59 -0700 Subject: [PATCH] Fix build issues --- .../src/driver/opengl/ContextManagerWGL.cpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/filament/src/driver/opengl/ContextManagerWGL.cpp b/filament/src/driver/opengl/ContextManagerWGL.cpp index cec533a22b..8a1ab51158 100644 --- a/filament/src/driver/opengl/ContextManagerWGL.cpp +++ b/filament/src/driver/opengl/ContextManagerWGL.cpp @@ -25,6 +25,7 @@ #include "GL/glext.h" #include "GL/wglext.h" +#include #include namespace filament { @@ -61,7 +62,7 @@ std::unique_ptr ContextManagerWGL::createDriver(void* const sharedGLCont mHWnd = CreateWindowA("STATIC", "dummy", 0, 0, 0, 1, 1, NULL, NULL, NULL, NULL); HDC whdc = mWhdc = GetDC(mHWnd); if (whdc == NULL) { - slog.e << "CreateWindowA() failed" << io::endl; + utils::slog.e << "CreateWindowA() failed" << utils::io::endl; goto error; } @@ -71,7 +72,7 @@ std::unique_ptr ContextManagerWGL::createDriver(void* const sharedGLCont // We need a tmp context to retrieve and call wglCreateContextAttribsARB. HGLRC tempContext = wglCreateContext(whdc); if (!wglMakeCurrent(whdc, tempContext)) { - slog.e << "wglMakeCurrent() failed, whdc=" << whdc << ", tempContext=" << tempContext << io::endl; + utils::slog.e << "wglMakeCurrent() failed, whdc=" << whdc << ", tempContext=" << tempContext << utils::io::endl; goto error; } @@ -79,7 +80,7 @@ std::unique_ptr ContextManagerWGL::createDriver(void* const sharedGLCont (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB"); mContext = wglCreateContextAttribs(whdc, nullptr, attribs); if (!mContext) { - slog.e << "wglCreateContextAttribs() failed, whdc=" << whdc << io::endl; + utils::slog.e << "wglCreateContextAttribs() failed, whdc=" << whdc << utils::io::endl; goto error; } @@ -88,7 +89,7 @@ std::unique_ptr ContextManagerWGL::createDriver(void* const sharedGLCont tempContext = NULL; if (!wglMakeCurrent(whdc, mContext)) { - slog.e << "wglMakeCurrent() failed, whdc=" << whdc << ", mContext=" << mContext << io::endl; + utils::slog.e << "wglMakeCurrent() failed, whdc=" << whdc << ", mContext=" << mContext << utils::io::endl; goto error; } @@ -100,7 +101,7 @@ error: if (tempContext) { wglDeleteContext(tempContext); } - terminate(): + terminate(); return NULL; } @@ -110,11 +111,12 @@ void ContextManagerWGL::terminate() noexcept { wglDeleteContext(mContext); mContext = NULL; } - if (mWhdc) { - ReleaseHDC(mWhdc); + if (mHWnd && mWhdc) { + ReleaseDC(mHWnd, mWhdc); + DestroyWindow(mHWnd); + mHWnd = NULL; mWhdc = NULL; - } - if (mHWnd) { + } else if (mHWnd) { DestroyWindow(mHWnd); mHWnd = NULL; }