gfxhash_t hash;
GLuint texID;
int width, height;
+ unsigned char*data;
struct _imgopengl*next;
} imgopengl_t;
-imgopengl_t*img2texid = 0;
+static imgopengl_t*img2texid = 0;
-gfxhash_t gfximage_hash(gfximage_t*img)
+static gfxhash_t gfximage_hash(gfximage_t*img)
{
int t;
int size = img->width*img->height*4;
return hash;
}
-imgopengl_t*addTexture(gfximage_t*img)
+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;
i->height = newheight;
unsigned char*data = malloc(newwidth*newheight*4);
+ i->data = data;
int x,y;
for(y=0;y<img->height;y++) {
for(x=0;x<img->width;x++) {
{
dbg("result:destroy");
free(gfx);
+ delTextures();
}
gfxresult_t*opengl_finish(struct _gfxdevice*dev)