createFragmentShader

open fun createFragmentShader(samplerVarName: String, fragCoordsVarName: String): String?

Creates the fragment shader code with the given variable names.

The provider must use the variable names to construct the shader code, or it will fail to create the OpenGL program when the provider is used. For example:

`#extension GL_OES_EGL_image_external : require
precision mediump float;
uniform samplerExternalOES {$samplerVarName};
varying vec2 {$fragCoordsVarName};
void main() {
vec4 sampleColor = texture2D({$samplerVarName}, {$fragCoordsVarName});
gl_FragColor = vec4(
sampleColor.r * 0.5 + sampleColor.g * 0.8 + sampleColor.b * 0.3,
sampleColor.r * 0.4 + sampleColor.g * 0.7 + sampleColor.b * 0.2,
sampleColor.r * 0.3 + sampleColor.g * 0.5 + sampleColor.b * 0.1,
1.0);
}
`
*

Return

the shader code. Return null to use the default shader.

Parameters

samplerVarName

the variable name of the samplerExternalOES.

fragCoordsVarName

the variable name of the fragment coordinates.