Java Examples for android.opengl.GLES20.glDeleteTextures
The following java examples will help you to understand the usage of android.opengl.GLES20.glDeleteTextures. These source code samples are taken from different open source projects.
Example 1
Project: FxCameraApp-master File: GlImageTexture.java View source code |
protected final void attachToTexture(final Bitmap bitmap) {
if (bitmap == null) {
throw new IllegalArgumentException("Bitmap must not be null");
}
if (bitmap.isRecycled()) {
throw new IllegalStateException("Bitmap is recycled");
}
final int[] saveFramebuffer = new int[1];
glGetIntegerv(GL_FRAMEBUFFER_BINDING, saveFramebuffer, 0);
final int[] saveViewport = new int[4];
glGetIntegerv(GL_VIEWPORT, saveViewport, 0);
final int[] saveTexName = new int[1];
glGetIntegerv(GL_TEXTURE_BINDING_2D, saveTexName, 0);
final GLES20FlipVerticalShader shader = new GLES20FlipVerticalShader();
final int[] textures = new int[1];
try {
glGenTextures(textures.length, textures, 0);
glBindTexture(GL_TEXTURE_2D, textures[0]);
OpenGlUtils.setupSampler(GL_TEXTURE_2D, GL_LINEAR, GL_NEAREST);
OpenGlUtils.texImage2D(GL_TEXTURE_2D, 0, bitmap, 0);
mFramebufferObject.setup(bitmap.getWidth(), bitmap.getHeight());
shader.setup();
shader.setFrameSize(mFramebufferObject.getWidth(), mFramebufferObject.getHeight());
mFramebufferObject.enable();
glViewport(0, 0, mFramebufferObject.getWidth(), mFramebufferObject.getHeight());
glClear(GL_COLOR_BUFFER_BIT);
shader.draw(textures[0], null);
} catch (final RuntimeException e) {
mFramebufferObject.release();
throw e;
} finally {
glDeleteTextures(textures.length, textures, 0);
shader.release();
glBindFramebuffer(GL_FRAMEBUFFER, saveFramebuffer[0]);
glViewport(saveViewport[0], saveViewport[1], saveViewport[2], saveViewport[3]);
glBindTexture(GL_TEXTURE_2D, saveTexName[0]);
}
}
Example 2
Project: android-PageFlip-master File: Page.java View source code |
/**
* Deletes unused texture ids
* <p>It should be called in OpenGL thread</p>
*/
public void deleteUnusedTextures() {
if (mUnusedTexSize > 0) {
glDeleteTextures(mUnusedTexSize, mUnusedTexIDs, 0);
mUnusedTexSize = 0;
}
}