libresman
diff examples/imgthumbs/src/thumbs.c @ 14:2fcd1fbb0d18
buggy piece of shit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 10 Feb 2014 12:11:02 +0200 |
parents | a42888d26839 |
children | 43a9fe4a80ee |
line diff
1.1 --- a/examples/imgthumbs/src/thumbs.c Sat Feb 08 07:41:39 2014 +0200 1.2 +++ b/examples/imgthumbs/src/thumbs.c Mon Feb 10 12:11:02 2014 +0200 1.3 @@ -14,6 +14,7 @@ 1.4 #endif 1.5 1.6 struct resman *texman; 1.7 +struct thumbnail *dbg; 1.8 1.9 static int load_res_texture(const char *fname, int id, void *cls); 1.10 static int done_res_texture(int id, void *cls); 1.11 @@ -26,6 +27,7 @@ 1.12 struct dirent *dent; 1.13 /* allocate dummy head node */ 1.14 struct thumbnail *list = calloc(1, sizeof *list); 1.15 + dbg = list; 1.16 1.17 /*unsigned int intfmt = GL_COMPRESSED_RGB; 1.18 if(!strstr((char*)glGetString(GL_EXTENSIONS), "GL_ARB_texture_compression")) { 1.19 @@ -88,6 +90,7 @@ 1.20 1.21 node->next = list->next; 1.22 node->prev = list; 1.23 + list->next = node; 1.24 } 1.25 closedir(dir); 1.26 1.27 @@ -122,7 +125,7 @@ 1.28 float view_aspect; 1.29 1.30 glGetIntegerv(GL_VIEWPORT, vp); 1.31 - view_aspect = (float)(vp[2] - vp[0]) / (vp[3] - vp[1]); 1.32 + view_aspect = (float)(vp[2] - vp[0]) / (float)(vp[3] - vp[1]); 1.33 1.34 glMatrixMode(GL_PROJECTION); 1.35 glPushMatrix(); 1.36 @@ -133,6 +136,7 @@ 1.37 1.38 thumbs = thumbs->next; /* skip dummy node */ 1.39 while(thumbs) { 1.40 + printf("drawing thumb: %s\n", thumbs->fname); 1.41 glPushMatrix(); 1.42 glTranslatef(x, y, 0); 1.43 1.44 @@ -252,6 +256,8 @@ 1.45 { 1.46 struct thumbnail *thumb = resman_get_res_data(texman, id); 1.47 1.48 + printf("deleting thumb %d: %s\n", id, thumb->fname); 1.49 + 1.50 if(thumb) { 1.51 if(thumb->tex) { 1.52 glDeleteTextures(1, &thumb->tex);