1 | // all these must be powers of two |
1 | // all these must be powers of two |
|
|
2 | // width and height better be <=256 as we use bytes in the rendercache |
2 | #define TC_WIDTH 256 |
3 | #define TC_WIDTH 256 |
3 | #define TC_HEIGHT 256 |
4 | #define TC_HEIGHT 256 |
4 | #define TC_ROUND 4 |
5 | #define TC_ROUND 4 |
5 | |
6 | |
6 | typedef struct { |
7 | typedef struct { |
… | |
… | |
43 | slices [i].name = 0; |
44 | slices [i].name = 0; |
44 | |
45 | |
45 | while (first_texture) |
46 | while (first_texture) |
46 | { |
47 | { |
47 | tc_texture *next = first_texture->next; |
48 | tc_texture *next = first_texture->next; |
48 | glDeleteTextures (1, &first_texture->name); |
49 | del_texture (first_texture->name); |
49 | g_slice_free (tc_texture, first_texture); |
50 | g_slice_free (tc_texture, first_texture); |
50 | first_texture = next; |
51 | first_texture = next; |
51 | } |
52 | } |
52 | |
53 | |
53 | ++tc_generation; |
54 | ++tc_generation; |
… | |
… | |
77 | if (!match) |
78 | if (!match) |
78 | { |
79 | { |
79 | match = g_slice_new (tc_texture); |
80 | match = g_slice_new (tc_texture); |
80 | match->next = first_texture; |
81 | match->next = first_texture; |
81 | first_texture = match; |
82 | first_texture = match; |
82 | glGenTextures (1, &match->name); |
83 | match->name = gen_texture (); |
83 | match->avail = TC_HEIGHT; |
84 | match->avail = TC_HEIGHT; |
84 | |
85 | |
85 | glBindTexture (GL_TEXTURE_2D, match->name); |
86 | glBindTexture (GL_TEXTURE_2D, match->name); |
86 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
87 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
87 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
88 | glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |