# Android OpenGL and non premultiplied textures

As I understand it; by default all bitmaps will will get the alpha channel premultiplied in Android if loaded using BitmapFactory.

My setup: I have a 32bit bitmap(.bmp) where the alpha channel has a gloss map and the rgb is a specular map.

Issue: I found out that I can load the bitmap without being premultiplied using the bitmap option:

opts.inPremultiplied = false;


Result: When I render the alpha channel of the texture like this in the shader:

gl_FragColor.rgb = vec3(texture.a);


The resulting mesh is all white and not shades of gray as expected.

I upload the texture with this method:

GLUtils.texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image, 0);


I have also tried using this approach

GLES20.glteximage


as well with the same result although I might have done something wrong there.

Can anyone spot where I have gone wrong or what else I need to do?

• maybe do gl_FragColor = vec4(vec3(texture.a), 1.0f); Nov 6, 2014 at 13:20