Java Code Examples for android.opengl.ETC1Util#loadTexture()

The following examples show how to use android.opengl.ETC1Util#loadTexture() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompressedTextureActivity.java    From codeexamples-android with Eclipse Public License 1.0 6 votes vote down vote up
public void load(GL10 gl) {
    int width = 128;
    int height = 128;
    Buffer image = createImage(width, height);
    ETC1Util.ETC1Texture etc1Texture = ETC1Util.compressTexture(image, width, height, 3, 3 * width);
    if (USE_STREAM_IO) {
        // Test the ETC1Util APIs for reading and writing compressed textures to I/O streams.
        try {
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            ETC1Util.writeTexture(etc1Texture, bos);
            ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
            ETC1Util.loadTexture(GLES10.GL_TEXTURE_2D, 0, 0,
                    GLES10.GL_RGB, GLES10.GL_UNSIGNED_SHORT_5_6_5, bis);
        } catch (IOException e) {
            Log.w(TAG, "Could not load texture: " + e);
        }
    } else {
        ETC1Util.loadTexture(GLES10.GL_TEXTURE_2D, 0, 0,
                GLES10.GL_RGB, GLES10.GL_UNSIGNED_SHORT_5_6_5, etc1Texture);
    }
}
 
Example 2
Source File: ETC1Texture.java    From tilt-game-android with MIT License 4 votes vote down vote up
@Override
protected void writeTextureToHardware(final GLState pGLState) throws IOException {
	final InputStream inputStream = this.getInputStream();
	ETC1Util.loadTexture(GLES20.GL_TEXTURE_2D, 0, 0, this.mPixelFormat.getGLFormat(), this.mPixelFormat.getGLType(), inputStream);
}
 
Example 3
Source File: ETC1Texture.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
@Override
protected void writeTextureToHardware(final GLState pGLState) throws IOException {
	final InputStream inputStream = this.getInputStream();
	ETC1Util.loadTexture(GLES20.GL_TEXTURE_2D, 0, 0, this.mPixelFormat.getGLFormat(), this.mPixelFormat.getGLType(), inputStream);
}