aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl/libui
diff options
context:
space:
mode:
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)