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:
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.
A stupid mistake.
After debugging with GAPID, I found out that the rendering texture was 1x1.
So all I have to do is to call surfaceTexture.setDefaultBufferSize(width, height)
to setup the correct width and height when libmpv finished loading files.