added check for compressed format support (ARB_internalformat_query2.txt) master origin/HEAD origin/master
authorEleni Maria Stea <estea@igalia.com>
Fri, 4 May 2018 17:46:31 +0000 (20:46 +0300)
committerEleni Maria Stea <estea@igalia.com>
Fri, 4 May 2018 17:46:31 +0000 (20:46 +0300)
Makefile
main.c

index 84363ff..cd3d9e2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ obj = main.o
 bin = test
 
 CFLAGS = -pedantic -Wall -g
-LDFLAGS = -lGL -lglut
+LDFLAGS = -lGLEW -lGL -lglut
 
 $(bin): $(obj)
        $(CC) -o $@ $(obj) $(LDFLAGS)
diff --git a/main.c b/main.c
index 32da284..a023307 100644 (file)
--- a/main.c
+++ b/main.c
@@ -3,6 +3,7 @@
 #include <string.h>
 #include <errno.h>
 #include <assert.h>
+#include <GL/glew.h>
 #include <GL/freeglut.h>
 
 #undef USE_SRGB
@@ -45,6 +46,8 @@ int main(int argc, char **argv)
        glutReshapeFunc(reshape);
        glutKeyboardFunc(keyb);
 
+       glewInit();
+
        if(init() == -1) {
                return 1;
        }
@@ -353,7 +356,11 @@ void print_compressed_formats(void)
        glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, fmtlist);
 
        for(i=0; i<num_fmt; i++) {
+               printf("\n");
                printf(" %05x: %s\n", fmtlist[i], fmtstr(fmtlist[i]));
+               GLint params;
+               glGetInternalformativ(GL_TEXTURE_2D, fmtlist[i], GL_TEXTURE_COMPRESSED, 1, &params);
+               printf("the format is %s\n", params == GL_TRUE ? "compressed" : "not compressed");
        }
        free(fmtlist);
 }