# HG changeset patch # User John Tsiombikas # Date 1392137253 -7200 # Node ID 0a789208498dc9e38de534727140a39c23647b6b # Parent a42888d26839d867473908f49dac6a3da0eff435 fixed resman.def added debug mode in thumbs.c diff -r a42888d26839 -r 0a789208498d examples/imgthumbs/src/main.c --- a/examples/imgthumbs/src/main.c Sat Feb 08 07:41:39 2014 +0200 +++ b/examples/imgthumbs/src/main.c Tue Feb 11 18:47:33 2014 +0200 @@ -9,7 +9,7 @@ static int init(void); static void cleanup(void); static void display(void); -/*static void idle(void);*/ +static void idle(void); static void reshape(int x, int y); static void keyb(unsigned char key, int x, int y); static void mouse(int bn, int st, int x, int y); @@ -40,7 +40,7 @@ glutCreateWindow("imgthumbs"); glutDisplayFunc(display); - glutIdleFunc(glutPostRedisplay); + glutIdleFunc(idle); glutReshapeFunc(reshape); glutKeyboardFunc(keyb); glutMouseFunc(mouse); @@ -105,12 +105,10 @@ assert(glGetError() == GL_NO_ERROR); } -/* static void idle(void) { glutPostRedisplay(); } -*/ static void reshape(int x, int y) { diff -r a42888d26839 -r 0a789208498d examples/imgthumbs/src/thumbs.c --- a/examples/imgthumbs/src/thumbs.c Sat Feb 08 07:41:39 2014 +0200 +++ b/examples/imgthumbs/src/thumbs.c Tue Feb 11 18:47:33 2014 +0200 @@ -9,6 +9,8 @@ #include "thumbs.h" #include "resman.h" +#define DBG_SYNC + #ifndef GL_COMPRESSED_RGB #define GL_COMPRESSED_RGB 0x84ed #endif @@ -27,12 +29,6 @@ /* allocate dummy head node */ struct thumbnail *list = calloc(1, sizeof *list); - /*unsigned int intfmt = GL_COMPRESSED_RGB; - if(!strstr((char*)glGetString(GL_EXTENSIONS), "GL_ARB_texture_compression")) { - printf("warning, no texture compression available.\n"); - intfmt = GL_RGB; - }*/ - if(!texman) { texman = resman_create(); resman_set_load_func(texman, load_res_texture, 0); @@ -46,8 +42,10 @@ } while((dent = readdir(dir))) { - /*int xsz, ysz; - unsigned char *pixels;*/ +#ifdef DBG_SYNC + int xsz, ysz; + unsigned char *pixels; +#endif struct thumbnail *node; if(!(node = malloc(sizeof *node))) { @@ -66,11 +64,12 @@ } strcat(node->fname, dent->d_name); - node->aspect = 1.0;/*(float)xsz / (float)ysz;*/ + node->aspect = 1.0; +#ifndef DBG_SYNC resman_lookup(texman, node->fname, node); - - /*if(!(pixels = img_load_pixels(node->fname, &xsz, &ysz, IMG_FMT_RGBA32))) { +#else + if(!(pixels = img_load_pixels(node->fname, &xsz, &ysz, IMG_FMT_RGBA32))) { free(node->fname); free(node); continue; @@ -82,9 +81,11 @@ glBindTexture(GL_TEXTURE_2D, node->tex); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexImage2D(GL_TEXTURE_2D, 0, intfmt, xsz, ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, xsz, ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); img_free_pixels(pixels); - */ + + node->aspect = (float)xsz / (float)ysz; +#endif node->next = list->next; node->prev = list; diff -r a42888d26839 -r 0a789208498d libresman.sln --- a/libresman.sln Sat Feb 08 07:41:39 2014 +0200 +++ b/libresman.sln Tue Feb 11 18:47:33 2014 +0200 @@ -6,6 +6,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libresman-static", "libresman-static.vcproj", "{30D59998-59D6-46D6-ADEC-9C716878317D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imgthumbs", "examples\imgthumbs\imgthumbs.vcproj", "{022D306F-6002-4EAD-ADF5-5B31BB339791}" + ProjectSection(ProjectDependencies) = postProject + {30D59998-59D6-46D6-ADEC-9C716878317D} = {30D59998-59D6-46D6-ADEC-9C716878317D} + {BCD20CF4-E710-4520-8A51-E29E221D53BA} = {BCD20CF4-E710-4520-8A51-E29E221D53BA} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff -r a42888d26839 -r 0a789208498d resman.def --- a/resman.def Sat Feb 08 07:41:39 2014 +0200 +++ b/resman.def Tue Feb 11 18:47:33 2014 +0200 @@ -7,8 +7,7 @@ resman_destroy resman_set_load_func - resman_set_create_func - resman_set_update_func + resman_set_done_func resman_set_destroy_func resman_lookup @@ -16,5 +15,7 @@ resman_poll + resman_get_res_name resman_set_res_data - resman_get_res_data \ No newline at end of file + resman_get_res_data + resman_get_res_result \ No newline at end of file