does one of jogl’s texture constructors have support for texture compression?
if so, how does it work. thanks!
does one of jogl’s texture constructors have support for texture compression?
if so, how does it work. thanks!
TextureIO supports the dds format, which can contain DXTn compressed textures.
If you need to create dds files from images I think the following should work (not tested)
TextureData data = TextureIO.newTextureData(someFile, GL.GL_COMPRESSED_RGB_DXT1, GL.GL_RGB, null);
Texture texture = TextureIO.newTexture(data);
TextureIO.write(texture, new File("foobar.dds"));
The essential bits are to pass GL.GL_COMPRESSED_RGB_DXT1 as internal format to cause OpenGL to compress the texture data and specify a file with the ‘dds’ as extension to cause the dds writer to be used.
I’m not sure what the pixel format parameter (I used GL.GL_RGB) is actually supposed to be…
Note that there appear to be issues reading back compressed texture data from the graphics card on Mac OS X, so you would be better off creating your DXTn compressed textures offline or writing a pure Java DXTn compressor. We may supply something like this in the future. Aside from that the compressed texture functionality in the TextureIO classes has recently been given a good workout by an engineer at NASA and had a bunch of bugs fixed, so it should be working fairly well.