/**
  * Resets this FBO into its initial state, releasing all resources that were
  * allocated during a call to init.
  */
 public void Reset()
 {
     int[] handle = { _frameBufferHandle };
     GLES20.GlDeleteFramebuffers(1, handle, 0);
     GLES20.GlDeleteTextures(_textureHandles.Length, _textureHandles, 0);
     _frameBufferHandle = -1;
     _textureHandles    = new int[0];
     _width             = _height = 0;
 }
Example #2
0
 public void resize(int width, int height)
 {
     if (FBO != 0)
     {
         int[] args = { RBOC, RBOD, FBO };
         GLES20.GlDeleteTextures(1, args, 0);
         GLES20.GlDeleteRenderbuffers(1, args, 1);
         GLES20.GlDeleteFramebuffers(1, args, 2);
         create(width, height);
     }
 }
        private int setupRenderTextureAndRenderbuffer(int width, int height)
        {
            if (mTextureId != -1)
            {
                GLES20.GlDeleteTextures(1, new int[] { mTextureId }, 0);
            }
            if (mRenderbufferId != -1)
            {
                GLES20.GlDeleteRenderbuffers(1, new int[] { mRenderbufferId }, 0);
            }
            if (mFramebufferId != -1)
            {
                GLES20.GlDeleteFramebuffers(1, new int[] { mFramebufferId }, 0);
            }

            mTextureId = createTexture(width, height);
            checkGlError("setupRenderTextureAndRenderbuffer: create texture");

            int[] renderbufferIds = new int[1];
            GLES20.GlGenRenderbuffers(1, renderbufferIds, 0);
            GLES20.GlBindRenderbuffer(36161, renderbufferIds[0]);
            GLES20.GlRenderbufferStorage(36161, 33189, width, height);

            mRenderbufferId = renderbufferIds[0];
            checkGlError("setupRenderTextureAndRenderbuffer: create renderbuffer");

            int[] framebufferIds = new int[1];
            GLES20.GlGenFramebuffers(1, framebufferIds, 0);
            GLES20.GlBindFramebuffer(36160, framebufferIds[0]);
            mFramebufferId = framebufferIds[0];

            GLES20.GlFramebufferTexture2D(36160, 36064, 3553, mTextureId, 0);

            GLES20.GlFramebufferRenderbuffer(36160, 36096, 36161, renderbufferIds[0]);

            int status = GLES20.GlCheckFramebufferStatus(36160);

            if (status != 36053)
            {
                throw new Java.Lang.RuntimeException("Framebuffer is not complete: " + Java.Lang.Integer.ToHexString(status));
            }

            GLES20.GlBindFramebuffer(36160, 0);

            return(framebufferIds[0]);
        }
Example #4
0
 public virtual void delete()
 {
     int[] buffers = { id };
     GLES20.GlDeleteFramebuffers(1, buffers, 0);
 }