+ //tesselatePolygon(i->tesselator_line, z, line);
+}
+
+typedef struct _gfxhash
+{
+ unsigned char d[16];
+} gfxhash_t;
+
+char gfxhash_compare(gfxhash_t*h1, gfxhash_t*h2)
+{
+ return !memcmp(h1->d, h2->d, 16);
+}
+
+typedef struct _imgopengl
+{
+ gfxhash_t hash;
+ GLuint texID;
+ int width, height;
+ unsigned char*data;
+ struct _imgopengl*next;
+} imgopengl_t;
+
+static imgopengl_t*img2texid = 0;
+
+static gfxhash_t gfximage_hash(gfximage_t*img)
+{
+ int t;
+ int size = img->width*img->height*4;
+ U8*data = (U8*)img->data;
+ gfxhash_t hash;
+ hash_md5(data, size, hash.d);
+ return hash;
+}
+
+static void delTextures()
+{
+ imgopengl_t*i = img2texid;
+ while(i) {
+ imgopengl_t*next = i->next;
+ if(i->data) {
+ glDeleteTextures(1, &i->texID);
+ free(i->data);
+ }
+ memset(i, 0, sizeof(imgopengl_t));
+ free(i);
+ i = next;
+ }
+}
+
+static imgopengl_t*addTexture(gfximage_t*img)
+{
+ gfxhash_t hash = gfximage_hash(img);
+ imgopengl_t*i = img2texid;
+