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