I am unclear whether the write method of TextureIO is capable of writing DDS files with mipmaps embedded in the file.
The following is the code I have:
TextureData texData = TextureIO.newTextureData(new File("images/test.png"),true,null);
texData.setInternalFormat(GL.GL_COMPRESSED_RGB_S3TC_DXT1_EXT);
Texture tex = TextureIO.newTexture(texData);
TextureIO.write(tex,new File("images/test.dds"));
What the code does to my understanding:
line 1) This reads a 1024x1024 .png file and makes a TextureData object out of it. Mipmaps are generated automatically by the chosen boolean.
line 2) Changes the internal format to compressed DXT1 which stores the data with 4 bits per pixel.
line 3) Makes a Texture object out of the TextureData.
line 4) Writes out a .dds file using the Texture Object.
The resulting .dds file is a 1024x1024 image with no mipmaps in it. Its file size is 512kb (just the base level image) as opposed to 682kb (base image plus all mipmap levels).
My intention is to automate the conversion of many .png files to .dds and have that functionality embedded into a program I am writing.
Am I missing something or does the TextureIO class not have the capability of saving mipmaps with the DDS files it writes?