GL import code cleanup. Added ability to load GLES library dynamically.

This commit is contained in:
Branimir Karadžić
2014-02-18 23:36:13 -08:00
parent c6f5fa3b25
commit db735f5ff6
9 changed files with 377 additions and 238 deletions
+10 -8
View File
@@ -20,8 +20,7 @@ namespace bgfx
PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI;
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
# include "glimports.h"
# undef GL_IMPORT
# include "glimports.h"
static ::Display* s_display;
static ::Window s_window;
@@ -220,13 +219,16 @@ namespace bgfx
void GlContext::import()
{
# define GL_IMPORT(_optional, _proto, _func, _import) \
{ \
_func = (_proto)glXGetProcAddress((const GLubyte*)#_import); \
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. glXGetProcAddress %s", #_import); \
}
# define GL_EXTENSION(_optional, _proto, _func, _import) \
{ \
if (NULL == _func) \
{ \
_func = (_proto)glXGetProcAddress((const GLubyte*)#_import); \
BX_TRACE(#_func " = " #_import " 0x%08x", _func); \
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. glXGetProcAddress %s", #_import); \
} \
}
# include "glimports.h"
# undef GL_IMPORT
}
} // namespace bgfx