nuclear@4: #ifdef WIN32 nuclear@4: #define WIN32_LEAN_AND_MEAN nuclear@4: #include nuclear@4: #endif nuclear@4: nuclear@4: #ifdef __APPLE__ nuclear@4: #include nuclear@4: #else nuclear@4: #include nuclear@4: #endif nuclear@4: nuclear@4: #include "vr_impl.h" nuclear@4: nuclear@7: static unsigned int eye_tex[2]; nuclear@7: static float tex_umin[2], tex_umax[2]; nuclear@7: static float tex_vmin[2], tex_vmax[2]; nuclear@7: nuclear@4: static int init(void) nuclear@4: { nuclear@4: return 0; nuclear@4: } nuclear@4: nuclear@7: static void present(void) nuclear@7: { nuclear@7: int i; nuclear@7: nuclear@7: glPushAttrib(GL_ENABLE_BIT | GL_TRANSFORM_BIT); nuclear@7: nuclear@7: glDisable(GL_LIGHTING); nuclear@7: glDisable(GL_DEPTH_TEST); nuclear@7: glDisable(GL_FOG); nuclear@7: glDisable(GL_CULL_FACE); nuclear@7: nuclear@7: glEnable(GL_TEXTURE_2D); nuclear@7: nuclear@7: glMatrixMode(GL_MODELVIEW); nuclear@7: glLoadIdentity(); nuclear@7: glMatrixMode(GL_PROJECTION); nuclear@7: glLoadIdentity(); nuclear@7: nuclear@7: for(i=0; i<2; i++) { nuclear@7: float x0 = i == 0 ? -1 : 0; nuclear@7: float x1 = i == 0 ? 0 : 1; nuclear@7: nuclear@7: glBindTexture(GL_TEXTURE_2D, eye_tex[i]); nuclear@7: nuclear@7: glBegin(GL_QUADS); nuclear@7: glTexCoord2f(tex_umin[i], tex_vmin[i]); nuclear@7: glVertex2f(x0, -1); nuclear@7: glTexCoord2f(tex_umax[i], tex_vmin[i]); nuclear@7: glVertex2f(x1, -1); nuclear@7: glTexCoord2f(tex_umax[i], tex_vmax[i]); nuclear@7: glVertex2f(x1, 1); nuclear@7: glTexCoord2f(tex_umin[i], tex_vmax[i]); nuclear@7: glVertex2f(x0, 1); nuclear@7: glEnd(); nuclear@7: } nuclear@7: nuclear@7: glPopMatrix(); nuclear@7: glMatrixMode(GL_MODELVIEW); nuclear@7: glPopMatrix(); nuclear@7: nuclear@7: glPopAttrib(); nuclear@7: nuclear@7: #ifdef WIN32 nuclear@7: SwapBuffers(wglGetCurrentDC()); nuclear@7: #endif nuclear@7: } nuclear@7: nuclear@7: static void set_eye_texture(int eye, unsigned int tex, float umin, float vmin, float umax, float vmax) nuclear@7: { nuclear@7: eye_tex[eye] = tex; nuclear@7: tex_umin[eye] = umin; nuclear@7: tex_umax[eye] = umax; nuclear@7: tex_vmin[eye] = vmin; nuclear@7: tex_vmax[eye] = vmax; nuclear@7: } nuclear@7: nuclear@4: struct vr_module *vr_module_null(void) nuclear@4: { nuclear@4: static struct vr_module m; nuclear@4: nuclear@4: if(!m.init) { nuclear@4: m.name = "null"; nuclear@4: m.init = init; nuclear@7: m.set_eye_texture = set_eye_texture; nuclear@7: m.present = present; nuclear@4: } nuclear@4: return &m; nuclear@4: }