intravenous

view src/cockpit.cc @ 3:94d4c60af435

some progress
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 22 Apr 2012 03:35:18 +0300
parents
children c6a6a64df6de
line source
1 #include "opengl.h"
2 #include "cockpit.h"
3 #include "tex.h"
5 static unsigned int tex;
7 bool cockpit_init()
8 {
9 if(!(tex = load_texture("data/cockpit.png"))) {
10 return false;
11 }
12 return true;
13 }
15 void cockpit_destroy()
16 {
17 free_texture(tex);
18 }
20 void cockpit_draw()
21 {
22 glPushAttrib(GL_ENABLE_BIT);
23 glDisable(GL_LIGHTING);
25 glEnable(GL_BLEND);
26 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
28 bind_texture(tex);
30 glMatrixMode(GL_MODELVIEW);
31 glPushMatrix();
32 glLoadIdentity();
33 glMatrixMode(GL_PROJECTION);
34 glPushMatrix();
35 glLoadIdentity();
37 glBegin(GL_QUADS);
38 glColor3f(1, 1, 1);
39 glTexCoord2f(0, 1); glVertex2f(-1, -1);
40 glTexCoord2f(1, 1); glVertex2f(1, -1);
41 glTexCoord2f(1, 0); glVertex2f(1, 1);
42 glTexCoord2f(0, 0); glVertex2f(-1, 1);
43 glEnd();
45 glPopMatrix();
46 glMatrixMode(GL_MODELVIEW);
47 glPopMatrix();
49 bind_texture(0);
51 glPopAttrib();
52 }