I'm facing a problem with GLSurfaceView + libmpv. After I studied some basics of OpenGL ES, I started implementing a video player on Android as follows:
- At first I used SurfaceView + default Android MediaPlayer class to play videos and it worked totally fine.
- Then I changed to GLSurfaceView but remained MediaPlayer class and there was also no problem with that.
- Next I used GLSurfaceView + libmpv. I can hear the video playing but only single color flickers on the screen.
As far as I know, I don't think there's a problem with my shader because I think it's quite simple as below:
private final String VSH_CODE =
"uniform mat4 uSTMatrix;\n"+
"attribute vec4 aPosition;\n"+
"attribute vec4 aTexCoord;\n"+
"varying vec2 vTexCoord;\n"+
"void main(){\n"+
" vTexCoord = aTexCoord.xy;\n"+
" gl_Position = aPosition*uSTMatrix;\n"+
"}";
private final String FSH_CODE =
"#extension GL_OES_EGL_image_external : require\n"+
"precision mediump float;\n"+
"varying vec2 vTexCoord;\n"+
//"uniform mat4 uColorMatrix;\n"+
"uniform samplerExternalOES sTexture;\n"+
"void main() {\n"+
//" gl_FragColor = uColorMatrix*texture2D(sTexture, vTexCoord).rgba;\n"+
" gl_FragColor = texture2D(sTexture, vTexCoord).rgba;\n"+
"}";
But I don't know what to do next to correct my application. Do I have to debug some GPU contents with Renderdoc or something? Any idea would be appreciated.