--- deliantra/Deliantra-Client/texcache.c 2006/07/04 23:23:32 1.1 +++ deliantra/Deliantra-Client/texcache.c 2007/08/12 08:44:22 1.4 @@ -1,4 +1,5 @@ // all these must be powers of two +// width and height better be <=256 as we use bytes in the rendercache #define TC_WIDTH 256 #define TC_HEIGHT 256 #define TC_ROUND 4 @@ -8,6 +9,8 @@ int x, y, w, h; } tc_area; +extern int tc_generation; + void tc_get (tc_area *area, int width, int height); void tc_put (tc_area *area); void tc_clear (); @@ -16,6 +19,8 @@ #include +int tc_generation; + typedef struct tc_texture { struct tc_texture *next; GLuint name; @@ -41,10 +46,12 @@ while (first_texture) { tc_texture *next = first_texture->next; - glDeleteTextures (1, &first_texture->name); + del_texture (first_texture->name); g_slice_free (tc_texture, first_texture); first_texture = next; } + + ++tc_generation; } void @@ -73,7 +80,7 @@ match = g_slice_new (tc_texture); match->next = first_texture; first_texture = match; - glGenTextures (1, &match->name); + match->name = gen_texture (); match->avail = TC_HEIGHT; glBindTexture (GL_TEXTURE_2D, match->name);