diff options
Diffstat (limited to 'tests/s3tc_crunch.c')
-rw-r--r-- | tests/s3tc_crunch.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/tests/s3tc_crunch.c b/tests/s3tc_crunch.c index 1169f462..57974109 100644 --- a/tests/s3tc_crunch.c +++ b/tests/s3tc_crunch.c @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) GLuint texture; { - #define DDS_SIZE 65664 + const int DDS_SIZE = 65664; FILE *dds = fopen("ship.dds", "rb"); assert(dds); char *ddsdata = (char*)malloc(DDS_SIZE); @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) GLuint texture2; { - #define DDS_SIZE 32896 + const int DDS_SIZE = 32896; FILE *dds = fopen("bloom.dds", "rb"); assert(dds); char *ddsdata = (char*)malloc(DDS_SIZE); @@ -131,6 +131,29 @@ int main(int argc, char *argv[]) glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); } + // third, a non-square texture with mipmaps + + GLuint texture3; + + { + const int DDS_SIZE = 43920; + FILE *dds = fopen("water.dds", "rb"); + assert(dds); + char *ddsdata = (char*)malloc(DDS_SIZE); + assert(fread(ddsdata, 1, DDS_SIZE, dds) == DDS_SIZE); + fclose(dds); + + glGenTextures( 1, &texture3 ); + glBindTexture( GL_TEXTURE_2D, texture3 ); + + assert(!glGetError()); + glCompressedTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 512, 64, 0, 512*64, ddsdata+128); + assert(!glGetError()); + + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + } + // Prepare and Render // Clear the screen before drawing @@ -154,7 +177,10 @@ int main(int argc, char *argv[]) glEnableClientState(GL_VERTEX_ARRAY); glVertexPointer(2, GL_FLOAT, 4*4, &vertexData[2]); - glDrawArrays(GL_QUADS, 0, 8); + glDrawArrays(GL_QUADS, 0, 4); + + glBindTexture( GL_TEXTURE_2D, texture3 ); + glDrawArrays(GL_QUADS, 4, 4); glDisableClientState(GL_TEXTURE_COORD_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); |