3 * Daniel Nelson - 11/2/0
5 * Copyright (C) 2000 Daniel Nelson
6 * Copyright (C) 2004 Andrew Sayman
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 * Daniel Nelson - aluminumangel.org
26 * Generates the textures for the clock.
33 #include "TextureLoader.h"
35 #include "Displayer.h"
37 GLuint
Displayer::clock_digit_textures
[11];
39 const char *clock_digit_texture_files
[11]
40 = { GC_DATA_DIRECTORY("clock_0.png"),
41 GC_DATA_DIRECTORY("clock_1.png"),
42 GC_DATA_DIRECTORY("clock_2.png"),
43 GC_DATA_DIRECTORY("clock_3.png"),
44 GC_DATA_DIRECTORY("clock_4.png"),
45 GC_DATA_DIRECTORY("clock_5.png"),
46 GC_DATA_DIRECTORY("clock_6.png"),
47 GC_DATA_DIRECTORY("clock_7.png"),
48 GC_DATA_DIRECTORY("clock_8.png"),
49 GC_DATA_DIRECTORY("clock_9.png"),
50 GC_DATA_DIRECTORY("clock_extra.png") };
52 void Displayer::generateClock ( )
56 glGenTextures(11, clock_digit_textures
);
58 for (int n
= 11; n
--; ) {
60 glBindTexture(GL_TEXTURE_2D
, clock_digit_textures
[n
]);
62 glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_WRAP_S
, GL_REPEAT
);
63 glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_WRAP_T
, GL_REPEAT
);
64 glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_LINEAR
);
65 glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, GL_LINEAR
);
67 texture
= TextureLoader::loadImageAlpha(clock_digit_texture_files
[n
],
68 DC_CLOCK_TEX_LENGTH
, DC_CLOCK_TEX_LENGTH
);
70 glTexImage2D(GL_TEXTURE_2D
, 0, GL_ALPHA
, DC_CLOCK_TEX_LENGTH
,
71 DC_CLOCK_TEX_LENGTH
, GL_FALSE
, GL_ALPHA
, GL_UNSIGNED_BYTE
, texture
);
73 if (texture
!= null
) {