From e97be61a752f13304e239ebad4cbe622cf092817 Mon Sep 17 00:00:00 2001 From: Kocsis Attila Date: Wed, 10 Jun 2015 15:52:12 +0200 Subject: [PATCH] added iOS GL extension function import --- src/glcontext_eagl.mm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/glcontext_eagl.mm b/src/glcontext_eagl.mm index 1f1c08802..2a756ea13 100644 --- a/src/glcontext_eagl.mm +++ b/src/glcontext_eagl.mm @@ -15,8 +15,13 @@ namespace bgfx { namespace gl # define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL # include "glimports.h" + static void* s_opengles = NULL; + void GlContext::create(uint32_t _width, uint32_t _height) { + s_opengles = bx::dlopen("/System/Library/Frameworks/OpenGLES.framework/OpenGLES"); + BX_CHECK(NULL != s_opengles, "OpenGLES dynamic library is not found!"); + BX_UNUSED(_width, _height); CAEAGLLayer* layer = (CAEAGLLayer*)g_platformData.nwh; layer.opaque = true; @@ -59,6 +64,8 @@ namespace bgfx { namespace gl , "glCheckFramebufferStatus failed 0x%08x" , glCheckFramebufferStatus(GL_FRAMEBUFFER) ); + + import(); } void GlContext::destroy() @@ -83,6 +90,8 @@ namespace bgfx { namespace gl EAGLContext* context = (EAGLContext*)m_context; [context release]; + + bx::dlclose(s_opengles); } void GlContext::resize(uint32_t _width, uint32_t _height, uint32_t _flags) @@ -121,6 +130,17 @@ namespace bgfx { namespace gl void GlContext::import() { + BX_TRACE("Import:"); +# define GL_EXTENSION(_optional, _proto, _func, _import) \ + { \ + if (_func == NULL) \ + { \ + _func = (_proto)bx::dlsym(s_opengles, #_import); \ + BX_TRACE("%p " #_func " (" #_import ")", _func); \ + } \ + BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGLES context. EAGLGetProcAddress(\"%s\")", #_import); \ + } +# include "glimports.h" } } /* namespace gl */ } // namespace bgfx