# HG changeset patch # User John Tsiombikas # Date 1414357814 -7200 # Node ID 3d224ad45cacc583123ca4b3bb09c1770c3d1161 # Parent 9c36ae39ad958ded79f4cd13059065176edafb7d linux fixes diff -r 9c36ae39ad95 -r 3d224ad45cac Makefile --- a/Makefile Sat Oct 25 20:07:55 2014 +0300 +++ b/Makefile Sun Oct 26 23:10:14 2014 +0200 @@ -3,7 +3,7 @@ bin = oculus2 CFLAGS = -pedantic -Wall -g `pkg-config --cflags sdl2` -LDFLAGS = $(libgl) `pkg-config --libs sdl2` -lovr +LDFLAGS = $(libgl) `pkg-config --libs sdl2` -lovr -lX11 ifeq ($(shell uname -s), Darwin) libgl = -framework OpenGL -lGLEW diff -r 9c36ae39ad95 -r 3d224ad45cac src/main.c --- a/src/main.c Sat Oct 25 20:07:55 2014 +0300 +++ b/src/main.c Sun Oct 26 23:10:14 2014 +0200 @@ -11,12 +11,15 @@ #include #include #include +#include +#include #ifdef WIN32 #define OVR_OS_WIN32 -#endif -#ifdef __APPLE__ +#elif defined(__APPLE__) #define OVR_OS_MAC +#else +#define OVR_OS_LINUX #endif #include @@ -99,6 +102,8 @@ return -1; } + XSynchronize(glXGetCurrentDisplay(), True); + glewInit(); if(!(hmd = ovrHmd_Create(0))) { @@ -160,6 +165,14 @@ glcfg.OGL.Window = sys_win; glcfg.OGL.DC = wglGetCurrentDC(); ovrHmd_AttachToWindow(hmd, sys_win, 0, 0); +#else + Display *dpy = glXGetCurrentDisplay(); + Window win = glXGetCurrentDrawable(); + assert(dpy && win); + + glcfg.OGL.Disp = dpy; + glcfg.OGL.Win = win; + ovrHmd_AttachToWindow(hmd, (void*)win, 0, 0); #endif printf("running in \"direct-hmd\" mode\n"); }