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]);
        }
      }
    }
  }
  /**
   * 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();
        }
      }
    }
  }
Esempio n. 3
0
 @Override
 public boolean glIsTexture(int texture) {
   return GLES20.glIsTexture(texture);
 }