mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-11-12 02:55:34 +00:00
GL import code cleanup. Added ability to load GLES library dynamically.
This commit is contained in:
+19
-13
@@ -22,8 +22,7 @@ namespace bgfx
|
||||
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
|
||||
|
||||
# define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
|
||||
# include "glimports.h"
|
||||
# undef GL_IMPORT
|
||||
# include "glimports.h"
|
||||
|
||||
static HGLRC createContext(HDC _hdc)
|
||||
{
|
||||
@@ -273,18 +272,25 @@ namespace bgfx
|
||||
|
||||
void GlContext::import()
|
||||
{
|
||||
# define GL_IMPORT(_optional, _proto, _func, _import) \
|
||||
{ \
|
||||
BX_TRACE("%s", #_import); \
|
||||
_func = (_proto)wglGetProcAddress(#_import); \
|
||||
if (_func == NULL) \
|
||||
{ \
|
||||
_func = (_proto)bx::dlsym(m_opengl32dll, #_import); \
|
||||
} \
|
||||
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. wglGetProcAddress(\"%s\")", #_import); \
|
||||
}
|
||||
BX_TRACE("Import:");
|
||||
# define GL_EXTENSION(_optional, _proto, _func, _import) \
|
||||
{ \
|
||||
if (NULL == _func) \
|
||||
{ \
|
||||
_func = (_proto)wglGetProcAddress(#_import); \
|
||||
if (_func == NULL) \
|
||||
{ \
|
||||
_func = (_proto)bx::dlsym(m_opengl32dll, #_import); \
|
||||
BX_TRACE(" %p " #_func " (" #_import ")", _func); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
BX_TRACE("wgl %p " #_func " (" #_import ")", _func); \
|
||||
} \
|
||||
BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. wglGetProcAddress(\"%s\")", #_import); \
|
||||
} \
|
||||
}
|
||||
# include "glimports.h"
|
||||
# undef GL_IMPORT
|
||||
}
|
||||
|
||||
} // namespace bgfx
|
||||
|
||||
Reference in New Issue
Block a user