Part of my texture loading code looks like this:

final Bitmap bitmap =
BitmapFactory.decodeResource(context.getResources(), resId);
GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
bitmap.recycle();

Following lines should be somewhere in initialization:

// Blending Function For Translucency Based On Source Alpha Value
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
gl.glEnable(GL10.GL_BLEND);


On Jun 21, 9:30 pm, Navigateur <naveen.c...@googlemail.com> wrote:
> I got it working! The right data order is ARGB, but it just wasn't
> accepting my original data for some reason (even though the data is
> fine)... so by writing it, pixel by pixel, to a new Bitmap.. it works
> (that's why RGBA version was treating the "A" as "B") Can anyone tell
> me why I have to write a new Bitmap (it's a waste of processing). Does
> the Bitmap have to be "mutable" or something?
>
> On Jun 21, 6:13 pm, Navigateur <naveen.c...@googlemail.com> wrote:
>
>
>
> > Correction: if I use the original ARGB format of the .png without
> > converting it to RGBA, it doesn't work at all. (But with RGBA it has
> > the problem as stated).
>
> > On Jun 21, 5:30 pm, Navigateur <naveen.c...@googlemail.com> wrote:
>
> > > I should add, maybe GL10's glTexImage2D is the way to go here but I
> > > can't get that working at all. Maybe I have the pixel buffer pixels in
> > > the wrong order, since I use Bitmap's copyPixelsToBuffer to create the
> > > pixels buffer (what's the correct ordering for pixels in this buffer)?
> > > Or is GLUtils.texImage2D is the best one to call?
>
> > > On Jun 21, 4:57 pm, Navigateur <naveen.c...@googlemail.com> wrote:
>
> > > > I can't seem to get GLUtils.texImage2D to use my full RGBA (A=my alpha
> > > > component). I've tried doing setEGLConfigChooser(8, 8, 8, 8, 0, 0);
> > > > getHolder().setFormat(PixelFormat.RGBA_8888);
>
> > > > I've tried converting the source image (.png in ARGB) to RGBA.. which
> > > > works ok for the ordering of data before texImage2D, but when it
> > > > draws, it draws yellow where it should be "transparent white"... which
> > > > suggests it's diminishing the "B"(blue) component instead of the
> > > > A(alpha) component. But the same thing happens when I just use the
> > > > orignal ARGB data instead ("B" diminishes instead of "A", leaving
> > > > yellow). I have no idea why but I'll keep trying, but has anybody done
> > > > this properly and has the answer?- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -

-- 
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

Reply via email to