mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Merge pull request #431 from attilaz/glimport
added iOS GL extension function import
This commit is contained in:
commit
284b8ef65b
1 changed files with 20 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue