From 666401e309e21b30285bc2545038a624c1c023eb Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Tue, 3 Jan 2012 22:49:31 +0100 Subject: [PATCH] added osx implementation. not tested, not even compiled once. hope it works --- src/engine/client/backend_sdl.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/engine/client/backend_sdl.h b/src/engine/client/backend_sdl.h index de0c6bd4a..ca3ae3e55 100644 --- a/src/engine/client/backend_sdl.h +++ b/src/engine/client/backend_sdl.h @@ -27,7 +27,26 @@ static void GL_ReleaseContext(const SGLContext &Context) { wglMakeCurrent(Context.m_hDC, NULL); } static void GL_SwapBuffers(const SGLContext &Context) { SwapBuffers(Context.m_hDC); } #elif defined(CONF_PLATFORM_MACOSX) - #error missing implementation + #warning Untested implementation. I have no Mac OS X machine to test on. Please test, verify, fix and then remove this warning + + struct SGLContext + { + AGLDrawable m_Drawable; + AGLContext m_Context; + }; + + static SGLContext GL_GetCurrentContext() + { + SGLContext Context; + Context.m_Drawable = aglGetCurrentDrawable(); + Context.m_Context = aglGetCurrentContext(); + return Context; + } + + static void GL_MakeCurrent(const SGLContext &Context) { aglMakeCurrent(Context.m_Drawable, Context.m_Context); } + static void GL_ReleaseContext(const SGLContext &Context) { aglMakeCurrent(Context.m_Drawable, NULL); } + static void GL_SwapBuffers(const SGLContext &Context) { aglSwapBuffers(Context.m_Drawable); } + #elif defined(CONF_FAMILY_UNIX) #include