Shader code is as follows, 44 exercise with uniform samplerExternalOES _MainTex;
The Properties {
_MainTex (" Texture ", 2 d)="white" {}
_UvTopLeftRight (" UV of top corners ", Vector)=(0, 1, 1, 1)
_UvBottomLeftRight (" UV of bottom corners ", Vector)=(0, 0, 1, 0)
}
//For GLES3 or GLES2 on device
SubShader
{
Pass
{
ZWrite Off
GLSLPROGRAM
# pragma only_renderers gles3 gles
# ifdef SHADER_API_GLES3
# the extension GL_OES_EGL_image_external_essl3: the require
# the else
# the extension GL_OES_EGL_image_external: the require
# endif
Uniform vec4 _UvTopLeftRight;
Uniform vec4 _UvBottomLeftRight;
# ifdef VERTEX
Varying vec2 textureCoord;
Void main ()
{
Vec2 uvTop=mix (_UvTopLeftRight. Xy, _UvTopLeftRight. Zw, gl_MultiTexCoord0. X);
Vec2 uvBottom=mix (_UvBottomLeftRight. Xy, _UvBottomLeftRight. Zw, gl_MultiTexCoord0. X);
TextureCoord=mix (uvTop, uvBottom gl_MultiTexCoord0. Y);
Gl_Position=gl_ModelViewProjectionMatrix * gl_Vertex;
}
# endif
# ifdef fragments
Varying vec2 textureCoord;
Uniform samplerExternalOES _MainTex;
Void main ()
{
# ifdef SHADER_API_GLES3
Gl_FragColor=texture (_MainTex textureCoord);
# the else
Gl_FragColor=textureExternal (_MainTex textureCoord);
# endif
}
# endif
ENDGLSL
}
}