+namespace
+{
+
+const char* IMAGE_FILENAME_ETC = DEMO_IMAGE_DIR "tx-etc1.ktx";
+const char* IMAGE_FILENAME_ASTC_LINEAR = DEMO_IMAGE_DIR "tx-astc-4x4-linear.ktx";
+const char* IMAGE_FILENAME_ASTC_LINEAR_NATIVE = DEMO_IMAGE_DIR "tx-astc-4x4-linear-native.astc";
+
+
+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
+);
+
+/**
+ * @brief Create a renderer to render an image and adds it to an actor
+ * @param[in] imagePath The path where the image file is located
+ * @param[in] actor The actor that will be used to render the image
+ * @param[in[ geometry The geometry to use
+ * @param[in] shader The shader to use
+ */
+void AddImage( const char*imagePath, Actor& actor, Geometry& geometry, Shader& shader )
+{
+ //Load the texture
+ Texture texture = DemoHelper::LoadTexture( imagePath );
+ TextureSet textureSet = TextureSet::New();
+ textureSet.SetTexture( 0u, texture );
+
+ //Create the renderer
+ Renderer renderer = Renderer::New( geometry, shader );
+ renderer.SetTextures( textureSet );
+
+ //Set actor size and add the renderer
+ actor.SetProperty( Actor::Property::SIZE, Vector2( texture.GetWidth(), texture.GetHeight() ) );
+ actor.AddRenderer( renderer );
+}