libresman
diff examples/imgthumbs/src/thumbs.c @ 17:43a9fe4a80ee
merged
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Tue, 11 Feb 2014 18:48:24 +0200 |
parents | 0a789208498d 2fcd1fbb0d18 |
children | 711698580eb0 |
line diff
1.1 --- a/examples/imgthumbs/src/thumbs.c Tue Feb 11 18:47:33 2014 +0200 1.2 +++ b/examples/imgthumbs/src/thumbs.c Tue Feb 11 18:48:24 2014 +0200 1.3 @@ -16,6 +16,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 @@ -28,6 +29,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 if(!texman) { 1.18 texman = resman_create(); 1.19 @@ -89,6 +91,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 @@ -123,7 +126,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 @@ -134,6 +137,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 @@ -253,6 +257,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);