libresman

diff examples/imgthumbs/src/thumbs.c @ 2:026cdd1737ff

added spaceball controls to the example and needless GLEW dependency
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 31 Jan 2014 03:40:00 +0200
parents 469ce01809bc
children 410c19c735b2
line diff
     1.1 --- a/examples/imgthumbs/src/thumbs.c	Fri Jan 31 03:17:24 2014 +0200
     1.2 +++ b/examples/imgthumbs/src/thumbs.c	Fri Jan 31 03:40:00 2014 +0200
     1.3 @@ -13,6 +13,12 @@
     1.4  	struct dirent *dent;
     1.5  	struct thumbnail *list = 0;
     1.6  
     1.7 +	unsigned int intfmt = GL_COMPRESSED_RGB;
     1.8 +	if(!GLEW_ARB_texture_compression) {
     1.9 +		printf("warning, no texture compression available.\n");
    1.10 +		intfmt = GL_RGB;
    1.11 +	}
    1.12 +
    1.13  	if(!(dir = opendir(dirpath))) {
    1.14  		fprintf(stderr, "failed to open directory: %s: %s\n", dirpath, strerror(errno));
    1.15  		return 0;
    1.16 @@ -50,7 +56,7 @@
    1.17  		glBindTexture(GL_TEXTURE_2D, node->tex);
    1.18  		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    1.19  		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    1.20 -		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, xsz, ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
    1.21 +		glTexImage2D(GL_TEXTURE_2D, 0, intfmt, xsz, ysz, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
    1.22  		img_free_pixels(pixels);
    1.23  
    1.24  		node->aspect = (float)xsz / (float)ysz;