+
+const float BUTTON_HEIGHT = 100.0f;
+const float BUTTON_COUNT = 5.0f;
+
+const std::string JPG_FILENAME = DEMO_IMAGE_DIR "gallery-medium-4.jpg";
+const std::string CAPTURE_FILENAME = "/tmp/native-image-capture.png";
+
+/**
+ * @brief Creates a shader used to render a native image
+ * @param[in] nativeImageInterface The native image interface
+ * @return A shader to render the native image
+ */
+Shader CreateShader( NativeImageInterface& nativeImageInterface )
+{
+ static const char* DEFAULT_SAMPLER_TYPENAME = "sampler2D";
+
+ 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 );
+ }
+
+ return Shader::New( VERTEX_SHADER_TEXTURE, fragmentShader );
+ }
+ else
+ {
+ return Shader::New( VERTEX_SHADER_TEXTURE, FRAGMENT_SHADER_TEXTURE );
+ }
+}
+