ETC1Util
open class ETC1Util
Utility methods for using ETC1 compressed textures.
Summary
Nested classes |
open |
A utility class encapsulating a compressed ETC1 texture.
|
Public methods |
open static ETC1Util.ETC1Texture! |
Helper function that compresses an image into an ETC1Texture.
|
open static ETC1Util.ETC1Texture! |
Create a new ETC1Texture from an input stream containing a PKM formatted compressed texture.
|
open static Boolean |
Check if ETC1 texture compression is supported by the active OpenGL ES context.
|
open static Unit |
Convenience method to load an ETC1 texture whether or not the active OpenGL context supports the ETC1 texture compression format.
|
open static Unit |
Convenience method to load an ETC1 texture whether or not the active OpenGL context supports the ETC1 texture compression format.
|
open static Unit |
Helper function that writes an ETC1Texture to an output stream formatted as a PKM file.
|
Public constructors
Public methods
compressTexture
open static fun compressTexture(
input: Buffer!,
width: Int,
height: Int,
pixelSize: Int,
stride: Int
): ETC1Util.ETC1Texture!
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
open static fun createTexture(input: InputStream!): ETC1Util.ETC1Texture!
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. |
Exceptions |
java.io.IOException |
|
isETC1Supported
open static fun isETC1Supported(): Boolean
Check if ETC1 texture compression is supported by the active OpenGL ES context.
Return |
Boolean |
true if the active OpenGL ES context supports ETC1 texture compression. |
loadTexture
open static fun loadTexture(
target: Int,
level: Int,
border: Int,
fallbackFormat: Int,
fallbackType: Int,
input: InputStream!
): Unit
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. |
Exceptions |
java.io.IOException |
|
loadTexture
open static fun loadTexture(
target: Int,
level: Int,
border: Int,
fallbackFormat: Int,
fallbackType: Int,
texture: ETC1Util.ETC1Texture!
): Unit
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
open static fun writeTexture(
texture: ETC1Util.ETC1Texture!,
output: OutputStream!
): Unit
Helper function that writes an ETC1Texture to an output stream formatted as a PKM file.
Exceptions |
java.io.IOException |
|