dbf-udg

view src/scroller.cc @ 10:1120c069eb17

foo
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 19 Feb 2013 23:46:44 +0200
parents 403ec1be3a1a
children
line source
1 #include <math.h>
2 #include "opengl.h"
3 #include "texture.h"
5 unsigned int hiero_tex;
7 bool init_scroller()
8 {
9 if(!(hiero_tex = load_texture("data/hieroglyph2.png"))) {
10 return false;
11 }
13 glBindTexture(GL_TEXTURE_2D, hiero_tex);
14 /*glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
15 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);*/
17 return true;
18 }
20 void destroy_scroller()
21 {
22 free_texture(hiero_tex);
23 hiero_tex = 0;
24 }
26 void draw_scroller(float sec)
27 {
28 return;
29 glPushAttrib(GL_ENABLE_BIT);
31 glDisable(GL_DEPTH_TEST);
32 glDisable(GL_LIGHTING);
33 glEnable(GL_TEXTURE_2D);
34 glBindTexture(GL_TEXTURE_2D, hiero_tex);
36 glMatrixMode(GL_MODELVIEW);
37 glPushMatrix();
38 glLoadIdentity();
39 glScalef(1.4, 0.4, 1.4);
40 glMatrixMode(GL_PROJECTION);
41 glPushMatrix();
42 glLoadIdentity();
43 glMatrixMode(GL_TEXTURE);
44 glPushMatrix();
45 glLoadIdentity();
47 glTranslatef(sec * 0.25, 0, 0);
49 glBegin(GL_QUADS);
50 glColor3f(1, 1, 1);
51 glTexCoord2f(0, 1); glVertex2f(-1, -1);
52 glTexCoord2f(1, 1); glVertex2f(1, -1);
53 glTexCoord2f(1, 0); glVertex2f(1, 1);
54 glTexCoord2f(0, 0); glVertex2f(-1, 1);
55 glEnd();
57 glPopMatrix();
58 glMatrixMode(GL_PROJECTION);
59 glPopMatrix();
60 glMatrixMode(GL_MODELVIEW);
61 glPopMatrix();
62 glPopAttrib();
63 }