Пример #1
0
 protected void onDestroy() {
   super.onDestroy();
   GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
   mToneCurveTexture[0] = -1;
   GLES20.glDeleteTextures(1, new int[] {mMaskGrey1TextureId}, 0);
   mMaskGrey1TextureId = -1;
   GLES20.glDeleteTextures(1, new int[] {mMaskGrey2TextureId}, 0);
   mMaskGrey2TextureId = -1;
   GLES20.glDeleteTextures(1, new int[] {mMaskGrey3TextureId}, 0);
   mMaskGrey3TextureId = -1;
 }
Пример #2
0
 public void destroy() {
   if (mTextureHandles != null) {
     GLES20.glDeleteTextures(mTextureHandles.length, mTextureHandles, 0);
     GLUtil.checkGlError("Destroy picture");
     mTextureHandles = null;
   }
 }
 public void deleteSingleTexture(int position) {
   Texture delTex = textures.get(position);
   int[] texturesId = new int[] {delTex.id};
   GLES20.glDeleteTextures(1, texturesId, 0);
   textures.remove(position);
   delTex = null;
 }
 public void clearAll() {
   if (textures != null && textures.size() > 0) {
     int[] texturesId = new int[textures.size()];
     for (int i = 0; i < textures.size(); i++) {
       texturesId[i] = textures.get(i).id;
     }
     GLES20.glDeleteTextures(texturesId.length, texturesId, 0);
   }
 }
 @Override
 public void destroy() {
   super.destroy();
   if (lookup_texture != 0) {
     int[] tex = new int[1];
     tex[0] = lookup_texture;
     GLES20.glDeleteTextures(1, tex, 0);
     lookup_texture = 0;
   }
 }
 public void release() {
   if (textureName > 0) {
     GLES20.glDeleteTextures(0, new int[] {textureName}, 0);
     textureName = -1;
   }
   if (surfaceTexture != null) {
     surfaceTexture.release();
     surfaceTexture = null;
   }
 }
  public void confirmTextures() {

    if (textures != null && textures.size() > 0) {

      for (Texture each : textures) {
        if (!GLES20.glIsTexture(each.id)) {
          Log.d("MyLogs", "texture restored " + each.id);
          int[] texturesId = new int[] {each.id};
          GLES20.glDeleteTextures(1, texturesId, 0);
          GLES20.glGenTextures(1, texturesId, 0);

          each.reload(context, texturesId[0]);
        }
      }
    }
  }
Пример #8
0
  @CalledByNative
  public void deallocate() {
    if (mCamera == null) return;

    stopCapture();
    try {
      mCamera.setPreviewTexture(null);
      if (mGlTextures != null) GLES20.glDeleteTextures(1, mGlTextures, 0);
      mCaptureFormat = null;
      mCamera.release();
      mCamera = null;
    } catch (IOException ex) {
      Log.e(TAG, "deallocate: failed to deallocate camera, " + ex);
      return;
    }
  }
 private int setupRenderTextureAndRenderbuffer(final int width, final int height) {
   if (this.mTextureId != -1) {
     GLES20.glDeleteTextures(1, new int[] {this.mTextureId}, 0);
   }
   if (this.mRenderbufferId != -1) {
     GLES20.glDeleteRenderbuffers(1, new int[] {this.mRenderbufferId}, 0);
   }
   if (this.mFramebufferId != -1) {
     GLES20.glDeleteFramebuffers(1, new int[] {this.mFramebufferId}, 0);
   }
   this.mTextureId = this.createTexture(width, height, this.mTextureFormat, this.mTextureType);
   this.mTextureFormatChanged = false;
   this.checkGlError("setupRenderTextureAndRenderbuffer: create texture");
   final int[] renderbufferIds = {0};
   GLES20.glGenRenderbuffers(1, renderbufferIds, 0);
   GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER, renderbufferIds[0]);
   GLES20.glRenderbufferStorage(
       GLES20.GL_RENDERBUFFER, GLES20.GL_DEPTH_COMPONENT16, width, height);
   this.mRenderbufferId = renderbufferIds[0];
   this.checkGlError("setupRenderTextureAndRenderbuffer: create renderbuffer");
   final int[] framebufferIds = {0};
   GLES20.glGenFramebuffers(1, framebufferIds, 0);
   GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, framebufferIds[0]);
   this.mFramebufferId = framebufferIds[0];
   GLES20.glFramebufferTexture2D(
       GLES20.GL_FRAMEBUFFER,
       GLES20.GL_COLOR_ATTACHMENT0,
       GLES20.GL_TEXTURE_2D,
       this.mTextureId,
       0);
   GLES20.glFramebufferRenderbuffer(
       GLES20.GL_FRAMEBUFFER,
       GLES20.GL_DEPTH_ATTACHMENT,
       GLES20.GL_RENDERBUFFER,
       renderbufferIds[0]);
   final int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER);
   if (status != GLES20.GL_FRAMEBUFFER_COMPLETE) {
     final String s = "Framebuffer is not complete: ";
     final String value = String.valueOf(Integer.toHexString(status));
     throw new RuntimeException((value.length() != 0) ? s.concat(value) : new String(s));
   }
   GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
   return framebufferIds[0];
 }
 private void release() {
   Logging.d(TAG, "Java releaseDecoder");
   checkOnMediaCodecThread();
   try {
     mediaCodec.stop();
     mediaCodec.release();
   } catch (IllegalStateException e) {
     Logging.e(TAG, "release failed", e);
   }
   mediaCodec = null;
   mediaCodecThread = null;
   if (useSurface) {
     surface.release();
     if (textureID != 0) {
       Logging.d(TAG, "Delete video decoder TextureID " + textureID);
       GLES20.glDeleteTextures(1, new int[] {textureID}, 0);
       textureID = 0;
     }
     eglBase.release();
     eglBase = null;
   }
 }
  /**
   * Method that removes all the textures from the queue
   *
   * @param reload Forces a reload of the queue
   */
  public void emptyTextureQueue(boolean reload) {
    synchronized (mSync) {
      // Recycle the textures
      try {
        List<GLESTextureInfo> all = mQueue.removeAll();
        for (GLESTextureInfo info : all) {
          if (GLES20.glIsTexture(info.handle)) {
            int[] textures = new int[] {info.handle};
            if (GLESUtil.DEBUG_GL_MEMOBJS) {
              Log.d(GLESUtil.DEBUG_GL_MEMOBJS_DEL_TAG, "glDeleteTextures: [" + info.handle + "]");
            }
            GLES20.glDeleteTextures(1, textures, 0);
            GLESUtil.glesCheckError("glDeleteTextures");
          }
          // Return the bitmap
          info.bitmap.recycle();
          info.bitmap = null;
        }
      } catch (EmptyQueueException eqex) {
        // Ignore
      }

      // Remove all pictures in the queue
      try {
        mQueue.removeAll();
      } catch (EmptyQueueException ex) {
        // Ignore
      }

      // Reload the queue
      if (reload) {
        synchronized (mBackgroundTask.mLoadSync) {
          mBackgroundTask.resetAvailableImages();
          mBackgroundTask.mLoadSync.notify();
        }
      }
    }
  }
Пример #12
0
 /** 删除贴图 */
 public void dispose() {
   GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0);
   int[] textureIds = {textureId};
   GLES20.glDeleteTextures(1, textureIds, 0);
 }
Пример #13
0
 @Override
 public void glDeleteTextures(int n, int[] textures, int offset) {
   GLES20.glDeleteTextures(n, textures, offset);
 }
Пример #14
0
 @Override
 public void glDeleteTextures(int n, IntBuffer textures) {
   GLES20.glDeleteTextures(n, textures);
 }
Пример #15
0
 /** Clean up opengl data. */
 public void cleanup() {
   GLES20.glDeleteShader(mVertexShaderHandle);
   GLES20.glDeleteShader(mFragmentShaderHandle);
   GLES20.glDeleteTextures(1, new int[] {mTextureDataHandle}, 0);
 }
 @Override
 public void glDeleteTextures(GL11 gl, int n, int[] textures, int offset) {
   GLES20.glDeleteTextures(n, textures, offset);
   GLES20Canvas.checkError();
 }
Пример #17
0
 public void onDestroy() {
   super.onDestroy();
   GLES20.glDeleteTextures(1, inputTextureHandles, 0);
   for (int i = 0; i < inputTextureHandles.length; i++) inputTextureHandles[i] = -1;
 }
Пример #18
0
 protected void onDestroy() {
   super.onDestroy();
   GLES20.glDeleteTextures(1, mToneCurveTexture, 0);
   mToneCurveTexture[0] = -1;
 }
Пример #19
0
 /** delete specific texture */
 public static void deleteTex(final int hTex) {
   if (DEBUG) Log.v(TAG, "deleteTex:");
   final int[] tex = new int[] {hTex};
   GLES20.glDeleteTextures(1, tex, 0);
 }
Пример #20
0
  @Override
  public void release() {
    GLES20.glDeleteTextures(1, new int[] {mTextureHandle}, 0);

    super.release();
  }
Пример #21
0
 @Override
 public boolean deleteTexture(final IGLTextureId texture) {
   checkOpenGLThread();
   GLES20.glDeleteTextures(1, new int[] {((GLTextureId_Android) texture).getGLTextureId()}, 0);
   return false;
 }