There are a lot of different phones, tablets and hardware configurations available when it comes to Android. Assuming that everything is working correctly right from the factory may be a little bit naive. At the moment a lot of developers still support Android 2.3 and some phones like the HTC Desire, HTC Desire S and Samsung Galaxy Ace have a little GPU from the Adreno 200 series (200 & 205) that does not work as all the other GPU’s regarding textures. Let us elaborate a bit on this as you should incorporate our hack if you use multiple textures per shaderprogram so that those users won’t complain .
When you create some sort of engine capable of combining rendering calls to keep your engine fast you will probably group all geometry that have the same texture into one rendering call. This will keep your calls to openGL small which is a good way to improve speed because the calls are quite expensive for your framerate. Where this type of functionality should work, it does not work entirely on the Adreno 200 series. All your objects/geometry using the same ShaderProgram will be rendered using only 1 texture.
What is causing it?
The Adreno ignores changes to the sampler value after the first call. This is a bug in the drivers of the Adreno 200 series. The first call it stores the texture unit id but afterwards it never looks at your calls anymore.
source: Developer Forum Qualcomm
The solutions (3)
- Use a different ShaderProgram for each texture you use. May be difficult to implement with dynamic textures.
- Use this code before your rendering code each time you want to use a different texture.
//HACK for ADRENO 200 series GLES20.glUseProgram(0); // We use our shaderprogram GLES20.glUseProgram(YourShaderProgram);
- Use the solution of Qualcomm’s thread (#14)
I hope this helps a bit and please do add one of the solutions to your projects when developing for Android 2.3. The problem will occur on the aforementioned phones!