dbf-udg

annotate 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
rev   line source
nuclear@3 1 #include <math.h>
nuclear@3 2 #include "opengl.h"
nuclear@3 3 #include "texture.h"
nuclear@3 4
nuclear@3 5 unsigned int hiero_tex;
nuclear@3 6
nuclear@3 7 bool init_scroller()
nuclear@3 8 {
nuclear@3 9 if(!(hiero_tex = load_texture("data/hieroglyph2.png"))) {
nuclear@3 10 return false;
nuclear@3 11 }
nuclear@3 12
nuclear@3 13 glBindTexture(GL_TEXTURE_2D, hiero_tex);
nuclear@3 14 /*glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
nuclear@3 15 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);*/
nuclear@3 16
nuclear@3 17 return true;
nuclear@3 18 }
nuclear@3 19
nuclear@3 20 void destroy_scroller()
nuclear@3 21 {
nuclear@3 22 free_texture(hiero_tex);
nuclear@3 23 hiero_tex = 0;
nuclear@3 24 }
nuclear@3 25
nuclear@3 26 void draw_scroller(float sec)
nuclear@3 27 {
nuclear@4 28 return;
nuclear@3 29 glPushAttrib(GL_ENABLE_BIT);
nuclear@3 30
nuclear@3 31 glDisable(GL_DEPTH_TEST);
nuclear@3 32 glDisable(GL_LIGHTING);
nuclear@3 33 glEnable(GL_TEXTURE_2D);
nuclear@3 34 glBindTexture(GL_TEXTURE_2D, hiero_tex);
nuclear@3 35
nuclear@3 36 glMatrixMode(GL_MODELVIEW);
nuclear@3 37 glPushMatrix();
nuclear@3 38 glLoadIdentity();
nuclear@3 39 glScalef(1.4, 0.4, 1.4);
nuclear@3 40 glMatrixMode(GL_PROJECTION);
nuclear@3 41 glPushMatrix();
nuclear@3 42 glLoadIdentity();
nuclear@3 43 glMatrixMode(GL_TEXTURE);
nuclear@3 44 glPushMatrix();
nuclear@3 45 glLoadIdentity();
nuclear@3 46
nuclear@3 47 glTranslatef(sec * 0.25, 0, 0);
nuclear@3 48
nuclear@3 49 glBegin(GL_QUADS);
nuclear@3 50 glColor3f(1, 1, 1);
nuclear@3 51 glTexCoord2f(0, 1); glVertex2f(-1, -1);
nuclear@3 52 glTexCoord2f(1, 1); glVertex2f(1, -1);
nuclear@3 53 glTexCoord2f(1, 0); glVertex2f(1, 1);
nuclear@3 54 glTexCoord2f(0, 0); glVertex2f(-1, 1);
nuclear@3 55 glEnd();
nuclear@3 56
nuclear@3 57 glPopMatrix();
nuclear@3 58 glMatrixMode(GL_PROJECTION);
nuclear@3 59 glPopMatrix();
nuclear@3 60 glMatrixMode(GL_MODELVIEW);
nuclear@3 61 glPopMatrix();
nuclear@3 62 glPopAttrib();
nuclear@3 63 }