aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl/libui
diff options
context:
space:
mode:
authorArisotura <thetotalworm@gmail.com>2019-04-01 04:50:48 +0200
committerArisotura <thetotalworm@gmail.com>2019-04-01 04:50:48 +0200
commit1f13d9ce80c0cd5e94ba883ff6bb30c95d48a48a (patch)
tree88ba77ce41be20b0f726897411974560de122862 /src/libui_sdl/libui
parent2d0d501d1ffe972dcc0a8879b95aaed9328650c7 (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.cpp2
-rw-r--r--src/libui_sdl/libui/windows/gl.cpp9
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)