conworlds

annotate src/vr/vr_null.c @ 4:e6948e131526

adding a vr wrapper
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 20 Aug 2014 06:33:43 +0300
parents
children 8b7da5ab814e
rev   line source
nuclear@4 1 #ifdef WIN32
nuclear@4 2 #define WIN32_LEAN_AND_MEAN
nuclear@4 3 #include <windows.h>
nuclear@4 4 #endif
nuclear@4 5
nuclear@4 6 #ifdef __APPLE__
nuclear@4 7 #include <OpenGL/gl.h>
nuclear@4 8 #else
nuclear@4 9 #include <GL/gl.h>
nuclear@4 10 #endif
nuclear@4 11
nuclear@4 12 #include "vr_impl.h"
nuclear@4 13
nuclear@4 14 static int init(void)
nuclear@4 15 {
nuclear@4 16 return 0;
nuclear@4 17 }
nuclear@4 18
nuclear@4 19 static void draw(unsigned int fbtex, float u, float maxu, float v, float maxv)
nuclear@4 20 {
nuclear@4 21 glPushAttrib(GL_ENABLE_BIT | GL_TRANSFORM_BIT);
nuclear@4 22
nuclear@4 23 glDisable(GL_LIGHTING);
nuclear@4 24 glDisable(GL_DEPTH_TEST);
nuclear@4 25 glDisable(GL_FOG);
nuclear@4 26 glDisable(GL_CULL_FACE);
nuclear@4 27
nuclear@4 28 glMatrixMode(GL_MODELVIEW);
nuclear@4 29 glLoadIdentity();
nuclear@4 30 glMatrixMode(GL_PROJECTION);
nuclear@4 31 glLoadIdentity();
nuclear@4 32
nuclear@4 33 glBegin(GL_QUADS);
nuclear@4 34 glTexCoord2f(u, v);
nuclear@4 35 glVertex2f(-1, -1);
nuclear@4 36 glTexCoord2f((u + maxu) / 2, v);
nuclear@4 37 glVertex2f(1, -1);
nuclear@4 38 glTexCoord2f((u + maxu) / 2, maxv);
nuclear@4 39 glVertex2f(1, 1);
nuclear@4 40 glTexCoord2f(u, maxv);
nuclear@4 41 glVertex2f(-1, 1);
nuclear@4 42 glEnd();
nuclear@4 43
nuclear@4 44 glPopMatrix();
nuclear@4 45 glMatrixMode(GL_MODELVIEW);
nuclear@4 46 glPopMatrix();
nuclear@4 47
nuclear@4 48 glPopAttrib();
nuclear@4 49 }
nuclear@4 50
nuclear@4 51 struct vr_module *vr_module_null(void)
nuclear@4 52 {
nuclear@4 53 static struct vr_module m;
nuclear@4 54
nuclear@4 55 if(!m.init) {
nuclear@4 56 m.name = "null";
nuclear@4 57 m.init = init;
nuclear@4 58 m.draw = draw;
nuclear@4 59 }
nuclear@4 60 return &m;
nuclear@4 61 }