- static const char* VERTEX_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
- attribute mediump vec2 aPosition;\n
- attribute mediump vec2 aTexCoord;\n
- uniform mediump mat4 uMvpMatrix;\n
- uniform mediump vec3 uSize;\n
- varying mediump vec2 vTexCoord;\n
- void main()\n
- {\n
- vec4 position = vec4(aPosition,0.0,1.0)*vec4(uSize,1.0);\n
- gl_Position = uMvpMatrix * position;\n
- vTexCoord = aTexCoord;\n
- }\n
- );
-
- static const char* FRAGMENT_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
- uniform lowp vec4 uColor;\n
- uniform sampler2D sTexture;\n
- varying mediump vec2 vTexCoord;\n
-
- void main()\n
- {\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
- }\n
- );
-
- NativeImageInterface::Extension* extension( nativeImageInterface.GetExtension() );
- if( extension )
- {
- std::string fragmentShader;
-
- //Get custom fragment shader prefix
- const char* fragmentPreFix = extension->GetCustomFragmentPreFix();
- if( fragmentPreFix )
- {
- fragmentShader = fragmentPreFix;
- fragmentShader += FRAGMENT_SHADER_TEXTURE;
- }
- else
- {
- fragmentShader = FRAGMENT_SHADER_TEXTURE;
- }
-
- //Get custom sampler type name
- const char* customSamplerTypename = extension->GetCustomSamplerTypename();
- if( customSamplerTypename )
- {
- fragmentShader.replace( fragmentShader.find( DEFAULT_SAMPLER_TYPENAME ), strlen(DEFAULT_SAMPLER_TYPENAME), customSamplerTypename );
- }