- dbg("fillbitmap");
- internal_t*i = (internal_t*)dev->internal;
- char running = 0;
- int len = 0;
- double*xyz=0;
- gfxline_t*l=0;
- glColor4f(1.0,0,0,1.0);
-
- i->currentz ++;
-
- GLuint texIDs[1];
- glGenTextures(1, texIDs);
+ 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;
+ }
+}