Skip to content

HowToUse

Rudolf Polzer edited this page Jul 19, 2011 · 5 revisions

How to use S2TC

Compressing

To compress a texture from a TGA file, use the s2tc_compress command line tool included with this package. Example usage:

s2tc_compress -t DXT1 < filename.tga > filename.dds

Note that compression quality is by default poor, as the defaults are set to work well for online compression. When using this tool, it is recommended to set the EnvironmentVariables to better values. For example:

export S2TC_COLORDIST_MODE=SRGB_MIXED
export S2TC_RANDOM_COLORS=32
export S2TC_REFINE_COLORS=LOOP
export S2TC_DITHER_MODE=FLOYDSTEINBERG
s2tc_compress -t DXT1 < filename.tga > filename.dds

Decompressing

To decompress a texture to a TGA file, use the s2tc_decompress command line tool included with this package. Example usage:

./s2tc_decompress < filename.tga > filename.dds

Using from OpenGL

The graphics card must support GL_EXT_texture_compression_s3tc. Then, you can upload S2TC textures as GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT or GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, respectively, when using Mesa together with the libtxc_dxtn library installed by this package.

Possibly, a S2TC-only extension will be created.

Clone this wiki locally