oculus2_psprite
changeset 20:6a3a9840c303
fixed on macosx
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 21 Jan 2015 11:29:30 +0200 |
parents | 1a832e88854a |
children | dc7af0f549b2 |
files | Makefile src/main.c |
diffstat | 2 files changed, 9 insertions(+), 7 deletions(-) [+] |
line diff
1.1 --- a/Makefile Wed Jan 14 07:11:11 2015 +0200 1.2 +++ b/Makefile Wed Jan 21 11:29:30 2015 +0200 1.3 @@ -3,12 +3,13 @@ 1.4 bin = oculus2 1.5 1.6 CFLAGS = -pedantic -Wall -g `pkg-config --cflags sdl2` 1.7 -LDFLAGS = $(libgl) `pkg-config --libs sdl2` -lovr -lX11 1.8 +LDFLAGS = $(libgl) `pkg-config --libs sdl2` -lovr $(libsys) 1.9 1.10 ifeq ($(shell uname -s), Darwin) 1.11 libgl = -framework OpenGL -lGLEW 1.12 else 1.13 libgl = -lGL -lGLU -lGLEW 1.14 + libsys = -lX11 1.15 endif 1.16 1.17 $(bin): $(obj)
2.1 --- a/src/main.c Wed Jan 14 07:11:11 2015 +0200 2.2 +++ b/src/main.c Wed Jan 21 11:29:30 2015 +0200 2.3 @@ -95,7 +95,7 @@ 2.4 2.5 x = y = SDL_WINDOWPOS_UNDEFINED; 2.6 flags = SDL_WINDOW_OPENGL; 2.7 - if(!(win = SDL_CreateWindow("press 'f' to move to the HMD", x, y, 1280, 800, flags))) { 2.8 + if(!(win = SDL_CreateWindow("press 'f' to move to the HMD", x, y, 1024, 640, flags))) { 2.9 fprintf(stderr, "failed to create window\n"); 2.10 return -1; 2.11 } 2.12 @@ -150,13 +150,14 @@ 2.13 */ 2.14 memset(&glcfg, 0, sizeof glcfg); 2.15 glcfg.OGL.Header.API = ovrRenderAPI_OpenGL; 2.16 - glcfg.OGL.Header.BackBufferSize = hmd->Resolution; 2.17 + glcfg.OGL.Header.BackBufferSize.w = win_width; 2.18 + glcfg.OGL.Header.BackBufferSize.h = win_height; 2.19 glcfg.OGL.Header.Multisample = 1; 2.20 2.21 -#ifdef WIN32 2.22 +#ifdef OVR_OS_WIN32 2.23 glcfg.OGL.Window = GetActiveWindow(); 2.24 glcfg.OGL.DC = wglGetCurrentDC(); 2.25 -#else 2.26 +#elif defined(OVR_OS_LINUX) 2.27 glcfg.OGL.Disp = glXGetCurrentDisplay(); 2.28 #endif 2.29 2.30 @@ -169,7 +170,7 @@ 2.31 */ 2.32 #ifdef WIN32 2.33 ovrHmd_AttachToWindow(hmd, glcfg.OGL.Window, 0, 0); 2.34 -#else 2.35 +#elif defined(OVR_OS_LINUX) 2.36 ovrHmd_AttachToWindow(hmd, (void*)glXGetCurrentDrawable(), 0, 0); 2.37 #endif 2.38 printf("running in \"direct-hmd\" mode\n"); 2.39 @@ -183,7 +184,7 @@ 2.40 * timewrap, which shifts the image before drawing to counter any lattency between the call 2.41 * to ovrHmd_GetEyePose and ovrHmd_EndFrame. 2.42 */ 2.43 - distort_caps = ovrDistortionCap_Chromatic | ovrDistortionCap_Vignette | ovrDistortionCap_TimeWarp | 2.44 + distort_caps = ovrDistortionCap_Chromatic | ovrDistortionCap_TimeWarp | 2.45 ovrDistortionCap_Overdrive; 2.46 if(!ovrHmd_ConfigureRendering(hmd, &glcfg.Config, distort_caps, hmd->DefaultEyeFov, eye_rdesc)) { 2.47 fprintf(stderr, "failed to configure distortion renderer\n");