delete opengl Frame Buffers - Android android.opengl

Android examples for android.opengl:OpenGL Buffer

Description

delete opengl Frame Buffers

Demo Code


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import javax.microedition.khronos.opengles.GL10;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.opengl.ETC1;
import android.opengl.ETC1Util;
import android.opengl.ETC1Util.ETC1Texture;
import android.opengl.GLES10;
import android.opengl.GLES20;
import android.opengl.GLException;
import android.opengl.GLUtils;

public class Main{
    public static boolean deleteFrameBuffers(int fbo) {
        if (!isFrameBuffer(fbo))
            return false;

        GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fbo);
        GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER,
                GLES20.GL_COLOR_ATTACHMENT0, GL10.GL_TEXTURE_2D, 0, 0);

        GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
        GLES20.glDeleteFramebuffers(1, new int[] { fbo }, 0);

        GLHelper20.checkGLError();/*from   w  ww  .  j  ava2s .  c  o  m*/
        return true;
    }
    public static boolean isFrameBuffer(int framebuffer) {
        return framebuffer != 0 && GLES20.glIsFramebuffer(framebuffer);
    }
    public static void checkGLError() {
        if (!GLHelper.EnableGLDebug())
            return;

        int error = GLES20.glGetError();

        if (error != GLES20.GL_NO_ERROR) {
            throw new GLException(error);
        }
    }
}

Related Tutorials