mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
Fixed GLFW3 integration on Linux.
This commit is contained in:
parent
0da6c77806
commit
4b60ddf44d
6 changed files with 129 additions and 104 deletions
|
@ -55,7 +55,7 @@ namespace bgfx
|
|||
namespace bgfx
|
||||
{
|
||||
///
|
||||
void x11SetDisplayWindow(void* _display, uint32_t _window);
|
||||
void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx = NULL);
|
||||
|
||||
} // namespace bgfx
|
||||
|
||||
|
@ -156,7 +156,8 @@ namespace bgfx
|
|||
# if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
|
||||
::Display* display = glfwGetX11Display();
|
||||
::Window window = glfwGetX11Window(_window);
|
||||
x11SetDisplayWindow(display, window);
|
||||
void* glx = glfwGetGLXContext(_window);
|
||||
x11SetDisplayWindow(display, window, glx);
|
||||
# elif BX_PLATFORM_OSX
|
||||
void* window = glfwGetCocoaWindow(_window);
|
||||
void* nsgl = glfwGetNSGLContext(_window);
|
||||
|
|
|
@ -42,6 +42,12 @@ function bgfxProject(_name, _kind, _defines)
|
|||
_defines,
|
||||
}
|
||||
|
||||
if _OPTIONS["with-glfw"] then
|
||||
defines {
|
||||
"BGFX_CONFIG_MULTITHREADED=0",
|
||||
}
|
||||
end
|
||||
|
||||
if _OPTIONS["with-ovr"] then
|
||||
defines {
|
||||
"BGFX_CONFIG_USE_OVR=1",
|
||||
|
|
|
@ -134,6 +134,15 @@ function exampleProject(_name)
|
|||
"glfw3"
|
||||
}
|
||||
|
||||
configuration { "linux" }
|
||||
links {
|
||||
"Xrandr",
|
||||
"Xinerama",
|
||||
"Xi",
|
||||
"Xxf86vm",
|
||||
"Xcursor",
|
||||
}
|
||||
|
||||
configuration { "osx" }
|
||||
linkoptions {
|
||||
"-framework CoreVideo",
|
||||
|
|
|
@ -44,11 +44,13 @@ namespace bgfx
|
|||
#elif BX_PLATFORM_LINUX
|
||||
void* g_bgfxX11Display;
|
||||
uint32_t g_bgfxX11Window;
|
||||
void* g_bgfxGLX;
|
||||
|
||||
void x11SetDisplayWindow(void* _display, uint32_t _window)
|
||||
void x11SetDisplayWindow(void* _display, uint32_t _window, void* _glx)
|
||||
{
|
||||
g_bgfxX11Display = _display;
|
||||
g_bgfxX11Window = _window;
|
||||
g_bgfxGLX = _glx;
|
||||
}
|
||||
#elif BX_PLATFORM_OSX
|
||||
void* g_bgfxNSWindow = NULL;
|
||||
|
|
|
@ -204,6 +204,7 @@ namespace bgfx
|
|||
#elif BX_PLATFORM_LINUX
|
||||
extern void* g_bgfxX11Display;
|
||||
extern uint32_t g_bgfxX11Window;
|
||||
extern void* g_bgfxGLX;
|
||||
#elif BX_PLATFORM_OSX
|
||||
extern void* g_bgfxNSWindow;
|
||||
extern void* g_bgfxNSGL;
|
||||
|
|
|
@ -55,6 +55,11 @@ namespace bgfx { namespace gl
|
|||
void GlContext::create(uint32_t _width, uint32_t _height)
|
||||
{
|
||||
BX_UNUSED(_width, _height);
|
||||
|
||||
m_context = (GLXContext)g_bgfxGLX;
|
||||
|
||||
if (NULL == m_context)
|
||||
{
|
||||
XLockDisplay( (::Display*)g_bgfxX11Display);
|
||||
|
||||
int major, minor;
|
||||
|
@ -171,6 +176,7 @@ namespace bgfx { namespace gl
|
|||
#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
|
||||
|
||||
XUnlockDisplay( (::Display*)g_bgfxX11Display);
|
||||
}
|
||||
|
||||
import();
|
||||
|
||||
|
|
Loading…
Reference in a new issue