ETC1Util
public class ETC1Util
extends Object
Utility methods for using ETC1 compressed textures.
Summary
Public methods |
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, InputStream input) 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, 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 |
writeTexture(ETC1Util.ETC1Texture texture, OutputStream output) Helper function that writes an ETC1Texture to an output stream formatted as a PKM file. |
Inherited methods |
From class java.lang.Object
Object |
clone() Creates and returns a copy of this object. |
boolean |
equals(Object obj) Indicates whether some other object is "equal to" this one. |
void |
finalize() Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. |
final Class<?> |
getClass() Returns the runtime class of this Object . |
int |
hashCode() Returns a hash code value for the object. |
final void |
notify() Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() Wakes up all threads that are waiting on this object's monitor. |
String |
toString() Returns a string representation of the object. |
final void |
wait(long millis, int nanos) Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed. |
final void |
wait(long millis) Causes the current thread to wait until either another thread invokes the notify() method or the notifyAll() method for this object, or a specified amount of time has elapsed. |
final void |
wait() Causes the current thread to wait until another thread invokes the notify() method or the notifyAll() method for this object. |
|
Public constructors
Public methods
compressTexture
ETC1Util.ETC1Texture compressTexture (Buffer input,
int width,
int height,
int pixelSize,
int stride)
Helper function that compresses an image into an ETC1Texture.
Parameters |
input |
Buffer : a native order direct buffer containing the image data |
width |
int : the width of the image in pixels |
height |
int : the height of the image in pixels |
pixelSize |
int : the size of a pixel in bytes (2 or 3) |
stride |
int : the width of a line of the image in bytes |
createTexture
ETC1Util.ETC1Texture createTexture (InputStream input)
Create a new ETC1Texture from an input stream containing a PKM formatted compressed texture.
Parameters |
input |
InputStream : an input stream containing a PKM formatted compressed texture. |
isETC1Supported
boolean isETC1Supported ()
Check if ETC1 texture compression is supported by the active OpenGL ES context.
Returns |
boolean |
true if the active OpenGL ES context supports ETC1 texture compression. |
loadTexture
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.
Parameters |
target |
int : the texture target. |
level |
int : the texture level |
border |
int : the border size. Typically 0. |
fallbackFormat |
int : the format to use if ETC1 texture compression is not supported. Must be GL_RGB. |
fallbackType |
int : 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 |
InputStream : the input stream containing an ETC1 texture in PKM format. |
loadTexture
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.
Parameters |
target |
int : the texture target. |
level |
int : the texture level |
border |
int : the border size. Typically 0. |
fallbackFormat |
int : the format to use if ETC1 texture compression is not supported. Must be GL_RGB. |
fallbackType |
int : 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 |
ETC1Util.ETC1Texture : the ETC1 to load. |
writeTexture
void writeTexture (ETC1Util.ETC1Texture texture,
OutputStream output)
Helper function that writes an ETC1Texture to an output stream formatted as a PKM file.
Parameters |
texture |
ETC1Util.ETC1Texture : the input texture. |
output |
OutputStream : the stream to write the formatted texture data to. |