nuclear@0: #include "vr_impl.h" nuclear@0: nuclear@0: #ifdef USE_OPENHMD nuclear@0: #include nuclear@0: #include nuclear@0: #include nuclear@0: #include "opt.h" nuclear@0: nuclear@0: /* a noble spirit embiggens the framebuffer to avoid aliasing in the middle */ nuclear@1: #define FB_EMBIGGEN 1.5 nuclear@0: nuclear@0: static ohmd_context *ctx; nuclear@0: static ohmd_device *dev; nuclear@0: static void *optdb; nuclear@0: static int new_frame = 1; nuclear@0: nuclear@0: static int disp_width, disp_height; nuclear@0: static float ipd; nuclear@0: nuclear@0: static struct { nuclear@0: unsigned int id; nuclear@0: float umin, umax; nuclear@0: float vmin, vmax; nuclear@0: } eye_tex[2]; nuclear@0: nuclear@0: nuclear@0: static int init(void) nuclear@0: { nuclear@0: int i, num_hmds; nuclear@0: nuclear@0: if(!(ctx = ohmd_ctx_create())) { nuclear@0: fprintf(stderr, "failed to create OpenHMD context\n"); nuclear@0: ohmd_ctx_destroy(ctx); nuclear@0: return -1; nuclear@0: } nuclear@0: if(!(num_hmds = ohmd_ctx_probe(ctx))) { nuclear@0: fprintf(stderr, "no HMDs detected\n"); nuclear@0: return -1; nuclear@0: } nuclear@0: nuclear@0: for(i=0; i