GL: Update exoplayer to use bindTexture.

Refactoring change only.

PiperOrigin-RevId: 446475708
This commit is contained in:
huangdarwin 2022-05-04 17:20:41 +01:00 committed by Ian Baker
parent c8c7ec61f0
commit 337b7f769d
2 changed files with 3 additions and 11 deletions

View File

@ -463,7 +463,7 @@ public final class GlUtil {
* GLES20#GL_TEXTURE_2D} for a two-dimensional texture or {@link
* GLES11Ext#GL_TEXTURE_EXTERNAL_OES} for an external texture.
*/
/* package */ static void bindTexture(int textureTarget, int texId) {
public static void bindTexture(int textureTarget, int texId) {
GLES20.glBindTexture(textureTarget, texId);
checkGlError();
GLES20.glTexParameteri(textureTarget, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);

View File

@ -300,19 +300,11 @@ public final class VideoDecoderGLSurfaceView extends GLSurfaceView
@RequiresNonNull("program")
private void setupTextures() {
GLES20.glGenTextures(3, yuvTextures, /* offset= */ 0);
GLES20.glGenTextures(/* n= */ 3, yuvTextures, /* offset= */ 0);
for (int i = 0; i < 3; i++) {
GLES20.glUniform1i(program.getUniformLocation(TEXTURE_UNIFORMS[i]), i);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0 + i);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, yuvTextures[i]);
GLES20.glTexParameterf(
GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(
GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR);
GLES20.glTexParameterf(
GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameterf(
GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE);
GlUtil.bindTexture(GLES20.GL_TEXTURE_2D, yuvTextures[i]);
}
GlUtil.checkGlError();
}