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.
38 #include "TextureLoader.h"
40 #include "Displayer.h"
42 GLuint
Displayer::clock_digit_textures
[11];
44 const char *clock_digit_texture_files
[11]
45 = { GC_DATA_DIRECTORY
"clock_0.tga",
46 GC_DATA_DIRECTORY
"clock_1.tga",
47 GC_DATA_DIRECTORY
"clock_2.tga",
48 GC_DATA_DIRECTORY
"clock_3.tga",
49 GC_DATA_DIRECTORY
"clock_4.tga",
50 GC_DATA_DIRECTORY
"clock_5.tga",
51 GC_DATA_DIRECTORY
"clock_6.tga",
52 GC_DATA_DIRECTORY
"clock_7.tga",
53 GC_DATA_DIRECTORY
"clock_8.tga",
54 GC_DATA_DIRECTORY
"clock_9.tga",
55 GC_DATA_DIRECTORY
"clock_extra.tga" };
57 void Displayer::generateClock ( )
61 glGenTextures(11, clock_digit_textures
);
63 for (int n
= 11; n
--; ) {
65 glBindTexture(GL_TEXTURE_2D
, clock_digit_textures
[n
]);
67 glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_WRAP_S
, GL_REPEAT
);
68 glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_WRAP_T
, GL_REPEAT
);
69 glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MAG_FILTER
, GL_LINEAR
);
70 glTexParameteri(GL_TEXTURE_2D
, GL_TEXTURE_MIN_FILTER
, GL_LINEAR
);
72 texture
= TextureLoader::loadAlphaTGA(clock_digit_texture_files
[n
],
73 DC_CLOCK_TEX_LENGTH
, DC_CLOCK_TEX_LENGTH
);
75 glTexImage2D(GL_TEXTURE_2D
, 0, GL_ALPHA
, DC_CLOCK_TEX_LENGTH
,
76 DC_CLOCK_TEX_LENGTH
, GL_FALSE
, GL_ALPHA
, GL_UNSIGNED_BYTE
, texture
);
78 if (texture
!= null
) {