I would like to mix camera preview SurfaceTexture
with some overlay texture. I am using these shaders for processing:
private final String vss = "attribute vec2 vPosition;\n"
+ "attribute vec2 vTexCoord;\n"
+ "varying vec2 texCoord;\n"
+ "void main() {\n"
+ " texCoord = vTexCoord;\n"
+ " gl_Position = vec4 ( vPosition.x, vPosition.y, 0.0, 1.0 );\n"
+ "}";
private final String fss = "#extension GL_OES_EGL_image_external : require\n"
+ "precision mediump float;\n"
+ "uniform samplerExternalOES sTexture;\n"
+ "uniform sampler2D filterTexture;\n"
+ "varying vec2 texCoord;\n"
+ "void main() {\n"
+" vec4 t_camera = texture2D(sTexture,texCoord);\n"
//+" vec4 t_overlayer = texture2D(filterTexture, texCoord);\n"
//+ " gl_FragColor = t_overlayer;\n" + "}";
+ " gl_FragColor = t_camera;\n" + "}";
My goal is to mix t_camera
and t_overlayer
. When I show t_camera
or t_overlayer
separately, it works (showing camera preview or texture). But when I uncomment t_overlayer
, then t_camera
becomes black (somehow badly sampled). My overlayer texture is 512x512 and CLAMPT_TO_EDGE
.
This problem occurs only for example on: Android Emulator, HTC Evo 3D.
But on SGS3, HTC One X, it works just fine.
What is wrong? Is it Evo 3D missing some extension or what?