vrchess

view 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
line source
1 #ifdef WIN32
2 #define WIN32_LEAN_AND_MEAN
3 #include <windows.h>
4 #endif
6 #ifdef __APPLE__
7 #include <OpenGL/gl.h>
8 #else
9 #include <GL/gl.h>
10 #endif
12 #include "vr_impl.h"
14 static int init(void)
15 {
16 return 0;
17 }
19 static void draw(unsigned int fbtex, float u, float maxu, float v, float maxv)
20 {
21 glPushAttrib(GL_ENABLE_BIT | GL_TRANSFORM_BIT);
23 glDisable(GL_LIGHTING);
24 glDisable(GL_DEPTH_TEST);
25 glDisable(GL_FOG);
26 glDisable(GL_CULL_FACE);
28 glMatrixMode(GL_MODELVIEW);
29 glLoadIdentity();
30 glMatrixMode(GL_PROJECTION);
31 glLoadIdentity();
33 glBegin(GL_QUADS);
34 glTexCoord2f(u, v);
35 glVertex2f(-1, -1);
36 glTexCoord2f((u + maxu) / 2, v);
37 glVertex2f(1, -1);
38 glTexCoord2f((u + maxu) / 2, maxv);
39 glVertex2f(1, 1);
40 glTexCoord2f(u, maxv);
41 glVertex2f(-1, 1);
42 glEnd();
44 glPopMatrix();
45 glMatrixMode(GL_MODELVIEW);
46 glPopMatrix();
48 glPopAttrib();
49 }
51 struct vr_module *vr_module_null(void)
52 {
53 static struct vr_module m;
55 if(!m.init) {
56 m.name = "null";
57 m.init = init;
58 m.draw = draw;
59 }
60 return &m;
61 }