I realize this is an old thread, but I'm having the same issue and the 
above solutions haven't worked for me.

Firstly the link to the PNGDecoder from libgdx is old and no longer exists 
(libgdx appear to have re-vamped the way they load images and tracking down 
where exactly the PNG decoding happens is a bit of a nightmare)

I tried directly calling GLES20.glTexImage2D using the pixels extracted 
from the Bitmap (as described above), but I still get gray artifacts on the 
edges of the texture.

For example:

The top image is the original PNG, the bottom is after rendering (taken 
from screenshot)

<https://lh6.googleusercontent.com/-Dyf568n0gD4/UiU4vJP80wI/AAAAAAAACsY/ygEOOrLYBao/s1600/cloud_text_problem.png>

The bottom image has gray pixel artifacts around the edge.  It's also sort 
of *blurry* which I can't work out either.

I tried manually decoding the PNG using this:

http://wiki.l33tlabs.org/bin/view/TWL/Using+the+TWL+PNGDecoder

But got the same result.

I'm creating the texture with:

GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, 
GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, 
GLES20.GL_LINEAR);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, 
GLES20.GL_CLAMP_TO_EDGE);
GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, 
GLES20.GL_CLAMP_TO_EDGE);

My fragment shader is pretty basic, just multiplies the texture color by a 
couple of other color values I pass in:

gl_FragColor = texture2D(u_Texture, v_TexCoordinate) * u_Color * v_Color;

Does anyone have a clue as to:

1) How I can render/create the texture without the artifacts
2) Why the texture is kind of blurry once it's rendered.

Thanks!


On Sunday, September 2, 2012 11:43:59 AM UTC-7, arberg wrote:
>
> Hi,
>
> I think it would make sense that either Bitmap could be without 
> premultiplied alpha, or GLUtils.texImage2D method could take as parameter 
> whether to load with or without premultiplied alpha. Since you say Bitmaps 
> will never be without premultiplied alpa, I suggest the latter, plus as you 
> suggest a convenience method on the Bitmap, which returns its content in an 
> array without premultiplied alpha.
>
> It makes sense to me to add the option to GLUtils.texImage2D since the 
> very purpose of the GLUtils class is '... to help bridging OpenGL ES and 
> Android APIs.' (javadoc class reference).
>
> Cheers Alex
>
> On Friday, 29 June 2012 21:18:59 UTC+2, Romain Guy (Google) wrote:
>>
>> Another big issue similar to alpha-premultiply is that 32Bit ARGB Images 
>>> are changed
>>> to 16Bit after scaling (especially if all alpha values are 255), without 
>>> some dirty tricks.
>>> This is a big issue to, it's far away from the precission needed for 
>>> good normal mapping.
>>>
>>
>> There was a bug in the scaling code that I fixed. a 32 bits image will 
>> now always be scaled to another 32 bits image.
>>  
>>
>>>
>>> -- 
>> Romain Guy
>> Android framework engineer
>> roma...@android.com
>>
>>  

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to