views:

37

answers:

2

Hi all I'm successfully generating my textures using GLUtils.texImage2D, but when I use the textures generated I get problems with my alpha: they are darker than wanted.

after having checked several things I finally got the the conclusions that the problem comes from GLUtils.texImage2D(GL10.GL_TEXTURE_2D, level, bmp, 0);

I created a second function that uses gl.glTexImage2D(GL10.GL_TEXTURE_2D, level, GL10.GL_RGBA, width, height, 0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, pixels2);

but it is costly in processing to create pixels2 which is a bytebuffer in which I have to recopy the bytes while changing the values from the bitmap ARGB to texture RGBA.

Has anybody noticed that ? and if so how did you solve this...

jason

A: 

There is an issues in GLUtils with premultiplied alpha. The only workaround that I can propose is to use:

gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA)

In case you need other blend functions you will have to use gl.glTexImage2D.

cement
A: 

Dear cement, Thank you for your answer, I'm already using

gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);

and I'm getting this problem

my problem is that the alpha generated by GLUtils isn't the one of the texture, its darker.

the difference is like looking at a color in the sun and in the shade (if that makes any sence).

I already tried gl.gltextimage2d but the creating the buffer takes too long, unless there is a tool to convert a bitmap to a byte buffer that I don't know of...