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