Java Code Examples for android.opengl.GLES20#glDeleteTextures()
The following examples show how to use
android.opengl.GLES20#glDeleteTextures() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RongRTCSurfaceTextureHelper.java From sealrtc-android with MIT License | 6 votes |
private void release() { if (handler.getLooper().getThread() != Thread.currentThread()) { throw new IllegalStateException("Wrong thread."); } if (isTextureInUse || !isQuitting) { throw new IllegalStateException("Unexpected release."); } yuvConverter.release(); GLES20.glDeleteTextures(1, new int[] {oesTextureId}, 0); surfaceTexture.release(); eglBase.release(); handler.getLooper().quit(); if (timestampAligner != null) { timestampAligner.dispose(); } }
Example 2
Source File: SurfaceTextureRender.java From DeviceConnect-Android with MIT License | 6 votes |
void surfaceDestroy() { if (mTextureID != 0) { GLES20.glDeleteTextures(1, new int[] {mTextureID}, 0); mTextureID = 0; } if (mVertexShader != 0) { GLES20.glDeleteShader(mVertexShader); mVertexShader = 0; } if (mFragmentShader != 0) { GLES20.glDeleteShader(mFragmentShader); mFragmentShader = 0; } if (mProgram != 0) { GLES20.glDeleteProgram(mProgram); mProgram = 0; } }
Example 3
Source File: MagicCameraInputFilter.java From TikTok with Apache License 2.0 | 5 votes |
public void destroyFramebuffers() { if (mFrameBufferTextures != null) { GLES20.glDeleteTextures(1, mFrameBufferTextures, 0); mFrameBufferTextures = null; } if (mFrameBuffers != null) { GLES20.glDeleteFramebuffers(1, mFrameBuffers, 0); mFrameBuffers = null; } mFrameWidth = -1; mFrameHeight = -1; }
Example 4
Source File: GLState.java From tilt-game-android with MIT License | 5 votes |
public void deleteTexture(final int pHardwareTextureID) { if (this.mCurrentBoundTextureIDs[this.mCurrentActiveTextureIndex] == pHardwareTextureID) { this.mCurrentBoundTextureIDs[this.mCurrentActiveTextureIndex] = -1; } this.mHardwareIDContainer[0] = pHardwareTextureID; GLES20.glDeleteTextures(1, this.mHardwareIDContainer, 0); }
Example 5
Source File: TextureHelper.java From sealrtc-android with MIT License | 5 votes |
public static int loadTexture(Bitmap bmp) { // 生成纹理ID final int[] textureObjectIds = new int[1]; GLES20.glGenTextures(1, textureObjectIds, 0); if (textureObjectIds[0] == 0) { Log.e(TAG, "loadTexture: texture Id is 0"); return 0; } if (bmp == null) { Log.e(TAG, "loadTexture: BitMap is NUll"); GLES20.glDeleteTextures(1, textureObjectIds, 0); return 0; } // 绑定纹理ID // 参数1:告诉OPenGl这个纹理是个二维纹理 GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureObjectIds[0]); // 设置过滤方式 // GL_TEXTURE_MIN_FILTER:表示缩小时使用的过滤方式GL_LINEAR_MIPMAP_LINEAR(MIP贴图级别直接插值的最近邻过滤) GLES20.glTexParameteri( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR_MIPMAP_LINEAR); // GL_TEXTURE_MAG_FILTER: 表示放大时使用的过滤方式GL_LINEAR(双线性过滤) GLES20.glTexParameteri( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); // 加载纹理到OpenGl并返回其ID GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bmp, 0); // 释放BitMap图像 bmp.recycle(); // 生成MIP贴图 GLES20.glGenerateMipmap(GLES20.GL_TEXTURE_2D); // 完成纹理加载后就可以解绑这个纹理了,以免调用意外调用其他方法改变这个纹理 GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0); return textureObjectIds[0]; }
Example 6
Source File: Utils.java From LearnOpenGL with MIT License | 5 votes |
public static int loadTexture(Context context, @DrawableRes int resId) { int[] textureObjectIds = new int[1]; GLES20.glGenTextures(1, textureObjectIds, 0); if (textureObjectIds[0] == 0) { Log.e(TAG, "Could not generate a new OpenGL texture object."); return 0; } BitmapFactory.Options options = new BitmapFactory.Options(); options.inScaled = false; Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resId, options); if (bitmap == null) { Log.e(TAG, "Resource ID " + resId + " could not be decoded."); GLES20.glDeleteTextures(1, textureObjectIds, 0); return 0; } // bind GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureObjectIds[0]); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR_MIPMAP_LINEAR); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0); bitmap.recycle(); GLES20.glGenerateMipmap(GLES20.GL_TEXTURE_2D); // unbind GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, 0); return textureObjectIds[0]; }
Example 7
Source File: Texture.java From smartGL with Apache License 2.0 | 4 votes |
void unbindTexture() { if (isBinded()) { GLES20.glDeleteTextures(1, mId, 0); mId[0] = UNBIND_VALUE; } }
Example 8
Source File: MDDrawingCache.java From Beginner-Level-Android-Studio-Apps with GNU General Public License v3.0 | 4 votes |
private void createFrameBuffer(int width, int height){ if (this.mTextureIdOutput != 0) { GLES20.glDeleteTextures(1, new int[] { this.mTextureIdOutput}, 0); } if (this.mRenderBufferId != 0) { GLES20.glDeleteRenderbuffers(1, new int[] { this.mRenderBufferId }, 0); } if (this.mFrameBufferId != 0) { GLES20.glDeleteFramebuffers(1, new int[] { this.mFrameBufferId }, 0); } GLES20.glGetIntegerv(GLES20.GL_FRAMEBUFFER_BINDING, originalFramebufferId, 0); // frame buffer int[] frameBuffer = new int[1]; GLES20.glGenFramebuffers(1, frameBuffer, 0); GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBuffer[0]); mFrameBufferId = frameBuffer[0]; glCheck("Multi Fish Eye frame buffer"); // renderer buffer 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); mRenderBufferId = renderbufferIds[0]; glCheck("Multi Fish Eye renderer buffer"); final int[] textureIds = { 0 }; GLES20.glGenTextures(1, textureIds, 0); GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureIds[0]); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, width, height, 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, (Buffer)null); mTextureIdOutput = textureIds[0]; glCheck("Multi Fish Eye texture"); // attach GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, mTextureIdOutput, 0); GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER, GLES20.GL_DEPTH_ATTACHMENT, GLES20.GL_RENDERBUFFER, renderbufferIds[0]); glCheck("Multi Fish Eye attach"); // check 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) : s); } GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, originalFramebufferId[0]); glCheck("Multi Fish Eye attach"); }
Example 9
Source File: BitmapTexture.java From Fatigue-Detection with MIT License | 4 votes |
public void destroy() { GLES20.glDeleteTextures(1, new int[]{imageTextureId}, 0); }
Example 10
Source File: Texture.java From HokoBlur with Apache License 2.0 | 4 votes |
@Override public void delete() { if (mTextureId != 0) { GLES20.glDeleteTextures(1, new int[]{mTextureId}, 0); } }
Example 11
Source File: BackgroundRenderer.java From justaline-android with Apache License 2.0 | 4 votes |
public void clearGL() { GLES20.glDeleteShader(mQuadProgram); GLES20.glDeleteTextures(1, new int[]{mTextureId}, 0); }
Example 12
Source File: GLDrawer2D.java From UVCCameraZxing with Apache License 2.0 | 4 votes |
/** * 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); }
Example 13
Source File: CameraGLRendererBase.java From real_time_circle_detection_android with MIT License | 4 votes |
private static void deleteTex(int[] tex) { if(tex.length == 1) { GLES20.glDeleteTextures(1, tex, 0); } }
Example 14
Source File: CameraGLRendererBase.java From ml-authentication with Apache License 2.0 | 4 votes |
private static void deleteTex(int[] tex) { if(tex.length == 1) { GLES20.glDeleteTextures(1, tex, 0); } }
Example 15
Source File: ToneCurveFilter.java From UltimateAndroid with Apache License 2.0 | votes |
@Override public void destroy() { super.destroy(); if(splineTexture != null && splineTexture[0] != 0) { GLES20.glDeleteTextures(1, splineTexture, 0); splineTexture = null; } }
Example 16
Source File: BitmapOutput.java From UltimateAndroid with Apache License 2.0 | votes |
private void initFBO() { if(frameBuffer != null) { GLES20.glDeleteFramebuffers(1, frameBuffer, 0); frameBuffer = null; } if(texture_out != null) { GLES20.glDeleteTextures(1, texture_out, 0); texture_out = null; } if(depthRenderBuffer != null) { GLES20.glDeleteRenderbuffers(1, depthRenderBuffer, 0); depthRenderBuffer = null; } frameBuffer = new int[1]; texture_out = new int[1]; depthRenderBuffer = new int[1]; GLES20.glGenFramebuffers(1, frameBuffer, 0); GLES20.glGenRenderbuffers(1, depthRenderBuffer, 0); GLES20.glGenTextures(1, texture_out, 0); GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, frameBuffer[0]); GLES20.glActiveTexture(GLES20.GL_TEXTURE0); GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texture_out[0]); GLES20.glTexImage2D(GLES20.GL_TEXTURE_2D, 0, GLES20.GL_RGBA, getWidth(), getHeight(), 0, GLES20.GL_RGBA, GLES20.GL_UNSIGNED_BYTE, null); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); GLES20.glFramebufferTexture2D(GLES20.GL_FRAMEBUFFER, GLES20.GL_COLOR_ATTACHMENT0, GLES20.GL_TEXTURE_2D, texture_out[0], 0); GLES20.glBindRenderbuffer(GLES20.GL_RENDERBUFFER, depthRenderBuffer[0]); GLES20.glRenderbufferStorage(GLES20.GL_RENDERBUFFER, GLES20.GL_DEPTH_COMPONENT16, getWidth(), getHeight()); GLES20.glFramebufferRenderbuffer(GLES20.GL_FRAMEBUFFER, GLES20.GL_DEPTH_ATTACHMENT, GLES20.GL_RENDERBUFFER, depthRenderBuffer[0]); int status = GLES20.glCheckFramebufferStatus(GLES20.GL_FRAMEBUFFER); if (status != GLES20.GL_FRAMEBUFFER_COMPLETE) { throw new RuntimeException(this+": Failed to set up render buffer with status "+status+" and error "+GLES20.glGetError()); } }
Example 17
Source File: GLTextureOutputRenderer.java From UltimateAndroid with Apache License 2.0 | votes |
@Override public void destroy() { super.destroy(); if(frameBuffer != null) { GLES20.glDeleteFramebuffers(1, frameBuffer, 0); frameBuffer = null; } if(texture_out != null) { GLES20.glDeleteTextures(1, texture_out, 0); texture_out = null; } if(depthRenderBuffer != null) { GLES20.glDeleteRenderbuffers(1, depthRenderBuffer, 0); depthRenderBuffer = null; } }
Example 18
Source File: LookupFilter.java From AndroidFastImageProcessing with MIT License | votes |
@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; } }
Example 19
Source File: ImageResourceInput.java From UltimateAndroid with Apache License 2.0 | votes |
private void loadTexture() { if(texture_in != 0) { int[] tex = new int[1]; tex[0] = texture_in; GLES20.glDeleteTextures(1, tex, 0); } texture_in = ImageHelper.bitmapToTexture(bitmap); newBitmap = false; markAsDirty(); }
Example 20
Source File: ToneCurveFilter.java From UltimateAndroid with Apache License 2.0 | votes |
@Override public void destroy() { super.destroy(); if(splineTexture != null && splineTexture[0] != 0) { GLES20.glDeleteTextures(1, splineTexture, 0); splineTexture = null; } }