public class ETC1Util extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ETC1Util.ETC1Texture
A utility class encapsulating a compressed ETC1 texture.
|
Constructor and Description |
---|
ETC1Util() |
Modifier and Type | Method and Description |
---|---|
static ETC1Util.ETC1Texture |
compressTexture(Buffer input,
int width,
int height,
int pixelSize,
int stride)
Helper function that compresses an image into an ETC1Texture.
|
static ETC1Util.ETC1Texture |
createTexture(InputStream input)
Create a new ETC1Texture from an input stream containing a PKM formatted compressed texture.
|
static boolean |
isETC1Supported()
Check if ETC1 texture compression is supported by the active OpenGL ES context.
|
static void |
loadTexture(int target,
int level,
int border,
int fallbackFormat,
int fallbackType,
ETC1Util.ETC1Texture texture)
Convenience method to load an ETC1 texture whether or not the active OpenGL context
supports the ETC1 texture compression format.
|
static void |
loadTexture(int target,
int level,
int border,
int fallbackFormat,
int fallbackType,
InputStream input)
Convenience method to load an ETC1 texture whether or not the active OpenGL context
supports the ETC1 texture compression format.
|
static void |
writeTexture(ETC1Util.ETC1Texture texture,
OutputStream output)
Helper function that writes an ETC1Texture to an output stream formatted as a PKM file.
|
public static void loadTexture(int target, int level, int border, int fallbackFormat, int fallbackType, InputStream input) throws IOException
target
- the texture target.level
- the texture levelborder
- the border size. Typically 0.fallbackFormat
- the format to use if ETC1 texture compression is not supported.
Must be GL_RGB.fallbackType
- the type to use if ETC1 texture compression is not supported.
Can be either GL_UNSIGNED_SHORT_5_6_5, which implies 16-bits-per-pixel,
or GL_UNSIGNED_BYTE, which implies 24-bits-per-pixel.input
- the input stream containing an ETC1 texture in PKM format.IOException
public static void loadTexture(int target, int level, int border, int fallbackFormat, int fallbackType, ETC1Util.ETC1Texture texture)
target
- the texture target.level
- the texture levelborder
- the border size. Typically 0.fallbackFormat
- the format to use if ETC1 texture compression is not supported.
Must be GL_RGB.fallbackType
- the type to use if ETC1 texture compression is not supported.
Can be either GL_UNSIGNED_SHORT_5_6_5, which implies 16-bits-per-pixel,
or GL_UNSIGNED_BYTE, which implies 24-bits-per-pixel.texture
- the ETC1 to load.public static boolean isETC1Supported()
public static ETC1Util.ETC1Texture createTexture(InputStream input) throws IOException
input
- an input stream containing a PKM formatted compressed texture.IOException
public static ETC1Util.ETC1Texture compressTexture(Buffer input, int width, int height, int pixelSize, int stride)
input
- a native order direct buffer containing the image datawidth
- the width of the image in pixelsheight
- the height of the image in pixelspixelSize
- the size of a pixel in bytes (2 or 3)stride
- the width of a line of the image in bytespublic static void writeTexture(ETC1Util.ETC1Texture texture, OutputStream output) throws IOException
texture
- the input texture.output
- the stream to write the formatted texture data to.IOException