Skip to main content
GameDev.net gamedev.net
๐Ÿ”’ Locked

android/opengles alpha textures not semitransparent but binary transparent

Started by ehmdjii Sep 6, 2010 at 5:34 AM 3 replies 1.6k views
Original Post
ehmdjii
ehmdjii
hello, i am drawing some textures with alpha channel, but when they are displayed it looks like the alpha channel is only binary. so a pixel is either transparent or opaque, although in the texture file itself the pixel is half-transparent.

is there a workaround for this problem?

the above shows how it should be like, and the below shows how it is:

Hodgman
Hodgman
You should show the code for how you're enabling transparency. It sounds like you're enabling alpha testing instead of alpha blending.
ehmdjii
ehmdjii
ok, this is how the blending is set up:

gl.glEnable(GL10.GL_BLEND);
gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
relsoft
relsoft
Did you try:

glBlendFunc(GL_SRC_ALPHA, GL_ONE)
Hi.
ehmdjii
ehmdjii
thanks for the hint. actually
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

did the trick.

however i am not sure if i want to use that. since on all my desktop opengl apps i use

gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
in conjunction with premultiplied alpha and it works fine!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.