I see, now I understand the color4f method. I can't sort the
transparent sprites back-to-front,because they are all in one vertex
array. It would be much slower if I had one vertex array for each
quad, because it would be so many drawArray calls.

I will only use one layer of quads from now on. But the particles in
the animation are morphed, so one particle will sometimes be placed
above another.
Do you mean that this will always result in black quads?

I will only use star1.png for testing,since you said that image was
correct. I used this guide to add the alpha channel:
http://fabiovisentin.com/tutorial/gimp_transparent_image/gimp_how_to_make_transparent_image.asp

On Oct 11, 4:22 pm, Latimerius <l4t1m3r...@googlemail.com> wrote:
> Hello, my guess would be you don't sort your transparent sprites
> back-to-front, do you?
>
> For a couple more comments please see inline:
>
> On Tue, Oct 11, 2011 at 11:51 AM, MobileVisuals
>
>
>
> <eyv...@astralvisuals.com> wrote:
> > before. I tried to remove the gl.glColor4f calls, but that made the
> > black square quads much more visible. This is how it looks like now,
> > with gl.glColor4f(1f, 1f, 1f, 0.4f);
>
> >http://www.mobile-visuals.com/color4f04.png
>
> > with gl.glColor4f(1f, 1f, 1f, 0.8f);
>
> >http://www.mobile-visuals.com/color4f08.png
>
> > with no with gl.glColor4f calls:
>
> >http://www.mobile-visuals.com/noColor4f.png
>
> > This shows that with higher alpha value in glColor4f, the more black
> > square quads. It also shows that the
> > smaller alpha value in glColor4f, the more dull result.
>
> glColor() used with texturing simply modulates the texel colours in
> your case.  By specifying (1,1,1, <1) you leave the hue alone but add
> 0.4f or 0.8f transparency.  Smaller alpha means dull because whatever
> you draw becomes almost transparent.  Similarly, higher alpha means
> what you draw is more visible, including the black artifacts.
>
> > This how the
> > source textures looks like now:
>
> >http://www.mobile-visuals.com/trance1.png
> >http://www.mobile-visuals.com/star1.png
> >http://www.mobile-visuals.com/star2.png
>
> BTW apart from star1.png these assets don't look correctly authored to
> me.  I don't know exactly what you're trying to achieve but I believe
> trance1.png and star2.png wouldn't work on a non-black background.
>
> > I have used 2 quads for each star, placed on each other here.
>
> This is where the above might bite you.  If you draw say star2.png
> over trance1.png the black component in star2.png's pixels will start
> to show.  I don't know if that's a problem for you, depends on what
> your objectives are.
>
> > gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE);
>
> Make sure your art *doesn't* have premultiplied alpha.  If it does
> then specifying GL_SRC_ALPHA would apply the alpha once more causing
> transparent pixels to darken.  You'd need GL_ONE in that case.
>
> > gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
> >                                GL10.GL_MODULATE);
>
> I believe this is the default so you could just as well leave it out.

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