Last active
June 14, 2018 13:12
-
-
Save BALUSANGEM/bbc2d18665579471724029d97a30cb17 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void createOnGlThread() { | |
// 1 texture to hold the video frame. | |
int textures[] = new int[1]; | |
GLES20.glGenTextures(1, textures, 0); | |
mTextureId = textures[0]; | |
int mTextureTarget = GLES11Ext.GL_TEXTURE_EXTERNAL_OES; | |
GLES20.glBindTexture(mTextureTarget, mTextureId); | |
GLES20.glTexParameteri(mTextureTarget, GLES20.GL_TEXTURE_MIN_FILTER, | |
GLES20.GL_NEAREST); | |
GLES20.glTexParameteri(mTextureTarget, GLES20.GL_TEXTURE_MAG_FILTER, | |
GLES20.GL_NEAREST); | |
videoTexture = new SurfaceTexture(mTextureId); | |
videoTexture.setOnFrameAvailableListener(this); | |
mTexCoordTransformationMatrix = new float[1][16]; | |
createQuardCoord(); | |
createQuadTextCoord(); | |
int vertexShader = loadGLShader(GLES20.GL_VERTEX_SHADER, VERTEX_SHADER); | |
int fragmentShader = loadGLShader( | |
GLES20.GL_FRAGMENT_SHADER, FRAGMENT_SHADER); | |
mQuadProgram = GLES20.glCreateProgram(); | |
GLES20.glAttachShader(mQuadProgram, vertexShader); | |
GLES20.glAttachShader(mQuadProgram, fragmentShader); | |
GLES20.glLinkProgram(mQuadProgram); | |
GLES20.glUseProgram(mQuadProgram); | |
ShaderUtil.checkGLError(TAG, "Program creation"); | |
mQuadPositionParam = GLES20.glGetAttribLocation(mQuadProgram, "a_Position"); | |
mQuadTexCoordParam = GLES20.glGetAttribLocation(mQuadProgram, "a_TexCoord"); | |
mModelViewProjectionUniform = GLES20.glGetUniformLocation( | |
mQuadProgram, "u_ModelViewProjection"); | |
ShaderUtil.checkGLError(TAG, "Program parameters"); | |
Matrix.setIdentityM(mModelMatrix, 0); | |
initializeMediaPlayer(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment