OSX: Fixed NSGLGetProcAddress and Remotery. Issue #595.

This commit is contained in:
Branimir Karadžić 2015-12-11 21:53:33 -08:00
parent 3e5f6095a0
commit c3dd88767a
2 changed files with 13 additions and 2 deletions

View file

@ -5381,7 +5381,8 @@ GLAPI GLenum GLAPIENTRY glGetError(void) { return 0; }
#if defined(_WIN32)
# define rmtGetProcAddress(name) wglGetProcAddress((LPCSTR)name)
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
# define rmtGetProcAddress(name) NSGLGetProcAddress(name)
void* nsglGetProcAddress(const GLubyte* _name);
# define rmtGetProcAddress(name) nsglGetProcAddress(name)
#elif defined(__sgi) || defined(__sun)
# define rmtGetProcAddress(name) dlGetProcAddress(name)
#elif defined(__ANDROID__)

View file

@ -207,11 +207,21 @@ namespace bgfx { namespace gl
_func = (_proto)bx::dlsym(s_opengl, #_import); \
BX_TRACE("%p " #_func " (" #_import ")", _func); \
} \
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. NSGLGetProcAddress(\"%s\")", #_import); \
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. GetProcAddress(\"%s\")", #_import); \
}
# include "glimports.h"
}
} /* namespace gl */ } // namespace bgfx
void* nsglGetProcAddress(const GLubyte* _name)
{
using namespace bgfx::gl;
if (NULL == s_opengl)
{
s_opengl = bx::dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL");
}
return bx::dlsym(s_opengl, (const char*)_name);
}
#endif // BX_PLATFORM_OSX && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)