2 /*! \page Texture_Compression Texture Compression
5 Using compressing the textures will:
7 <li> Speed up rendering in time the GPU == less power used due to less texture data being transferred.
8 <li> Reduce texture memory usage.
9 <li> Speed up load times. Smaller files mean quicker load times.
12 DALi supports the KTX file format.
13 You just load the compressed texture like you would any other image.
15 Image::New("my_compressed_file.ktx");
18 ARMS texture compression tool<br>
19 http://malideveloper.arm.com/develop-for-mali/tools/asset-creation/mali-gpu-texture-compression-tool/ <br>
21 Here is an example of using the ARM compression tool.
22 \image html compression-options.jpg
26 \image html compression-example.jpg
29 As shown above the ETC-1 compression format does not support alpha.<br> As a work around the tool will export
30 the alpha as a seperate compressed image.<br>
31 In order to combine both the images you need to use a custom shader.<br>
32 Here is an example shader:<br>
34 const char* const COMPRESSED_RGB_PLUS_SEPARATE_ALPHA_FRAGMENT_SOURCE =
38 " vec4 v4Color = (texture2D(sTexture, vTexCoord) * uColor);\n"
39 " v4Color.a = texture2D(sEffect, vTexCoord ).r;\n"
40 " gl_FragColor = v4Color;"
44 mShaderEffect = ShaderEffect::New( "", COMPRESSED_RGB_PLUS_SEPARATE_ALPHA_FRAGMENT_SOURCE);
46 mAtlasImageRGB = Image::New( ATLAS_RGB_FILENAME.KTX);
48 mAtlasImageAlpha = Image::New( ATLAS_ALPHA_FILENAME.KTX );
50 mShaderEffect.SetEffectImage( mAtlasImageAlpha );
54 // to create Image Actor
55 ImageActor imageActor = ImageActor::New( mAtlasImageRGB, GetImagePosition( info) );
57 imageActor.SetShaderEffect( mShaderEffect );
59 imageActor.SetBlendMode(BlendingMode::ON);