diff options
author | Arisotura <thetotalworm@gmail.com> | 2019-04-01 04:50:48 +0200 |
---|---|---|
committer | Arisotura <thetotalworm@gmail.com> | 2019-04-01 04:50:48 +0200 |
commit | 1f13d9ce80c0cd5e94ba883ff6bb30c95d48a48a (patch) | |
tree | 88ba77ce41be20b0f726897411974560de122862 /src/libui_sdl/libui | |
parent | 2d0d501d1ffe972dcc0a8879b95aaed9328650c7 (diff) |
* move GL init to main thread
* fix potential bug causing the screen bitmap to be created twice
Diffstat (limited to 'src/libui_sdl/libui')
-rw-r--r-- | src/libui_sdl/libui/windows/alloc.cpp | 2 | ||||
-rw-r--r-- | src/libui_sdl/libui/windows/gl.cpp | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/libui_sdl/libui/windows/alloc.cpp b/src/libui_sdl/libui/windows/alloc.cpp index cf6bd2e..e29d60e 100644 --- a/src/libui_sdl/libui/windows/alloc.cpp +++ b/src/libui_sdl/libui/windows/alloc.cpp @@ -32,7 +32,7 @@ void *uiAlloc(size_t size, const char *type) { byteArray *out; - out = new byteArray(size, 0); + out = new byteArray(size, 0);//printf("alloc %s at %08X\n", type, rawBytes(out)); heap[rawBytes(out)] = out; types[out] = type; return rawBytes(out); diff --git a/src/libui_sdl/libui/windows/gl.cpp b/src/libui_sdl/libui/windows/gl.cpp index eb7d33d..beccb79 100644 --- a/src/libui_sdl/libui/windows/gl.cpp +++ b/src/libui_sdl/libui/windows/gl.cpp @@ -120,7 +120,14 @@ void uiGLFreeContext(uiGLContext* ctx) void uiGLMakeContextCurrent(uiGLContext* ctx) { - wglMakeCurrent(ctx->dc, ctx->rc); + if (ctx == NULL) + { + wglMakeCurrent(NULL, NULL); + return; + } + + if (wglGetCurrentContext() == ctx->rc) return; + int res = wglMakeCurrent(ctx->dc, ctx->rc); } void *uiGLGetProcAddress(const char* proc) |