Index: talk/app/webrtc/java/android/org/webrtc/GlUtil.java |
diff --git a/talk/app/webrtc/java/android/org/webrtc/GlUtil.java b/talk/app/webrtc/java/android/org/webrtc/GlUtil.java |
index 196384edc9b1a6f0cd0312761e198056054678d3..de5dadbc88c4dc7e4ff25162fb61dfa84bdce7a1 100644 |
--- a/talk/app/webrtc/java/android/org/webrtc/GlUtil.java |
+++ b/talk/app/webrtc/java/android/org/webrtc/GlUtil.java |
@@ -58,4 +58,28 @@ public class GlUtil { |
fb.position(0); |
return fb; |
} |
+ |
+ /** |
+ * Generate texture with standard parameters. |
+ */ |
+ public static int generateTexture(int target) { |
+ final int textureArray[] = new int[1]; |
+ GLES20.glGenTextures(1, textureArray, 0); |
+ final int textureId = textureArray[0]; |
+ GLES20.glBindTexture(target, textureId); |
+ GLES20.glTexParameterf(target, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR); |
+ GLES20.glTexParameterf(target, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR); |
+ GLES20.glTexParameterf(target, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE); |
+ GLES20.glTexParameterf(target, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE); |
+ checkNoGLES2Error("generateTexture"); |
+ return textureId; |
+ } |
+ |
+ public static void deleteTexture(int textureId) { |
+ if (textureId != -1) { |
+ final int textureArray[] = new int[1]; |
+ textureArray[0] = textureId; |
+ GLES20.glDeleteTextures(1, textureArray, 0); |
hbos
2015/09/02 08:57:54
If you want this to be a one-liner you can do "new
magjed_webrtc
2015/09/02 10:15:39
Cool, thanks. This defeats the purpose of this fun
|
+ } |
+ } |
} |