I seem to notice in various rendering routines that I have to put ALPHAMODE -1 over and over again, or my image transparency doesn't work. Is there some reason for this? Should I be literally using it for every DRAW command I have?
If you are using alpha transparent .PNG images then you need to put this before drawing the images. You can either put it in once then have every sprite drawn after that or as necessary if you turn off/.use other alpha transparency between different draws.
EG -
ALPHAMODE -1
DRAWSPRITE sprite1,x,y //Alpha transparent sprite
DRAWSPRITE sprite2,x,y //Alpha transparent sprite
DRAWSPRITE sprite3,x,y //Alpha transparent sprite
DRAWSPRITE sprite4,x,y //Alpha transparent sprite
Or
ALPHAMODE -1
DRAWSPRITE sprite1,x,y //Alpha transparent sprite
ALPHAMODE -0.5
DRAWSPRITE sprite5,x,y //Alpha transparent sprite
ALPHAMODE -1
DRAWSPRITE sprite1,x,y //Alpha transparent sprite
It's quicker to draw all the same alpha'd sprites in one batch rather than keep switching, but obviously this isn't always possible.
Quote from: Ian Price on 2011-Sep-25
If you are using alpha transparent .PNG images then you need to put this before drawing the images.
ALPHAMODE (eg. -0.5) is related to opaque effects and not really related to transparency. :nana:
I've never needed to use ALPHAMODE -1 for transparent PNG (exported from Photoshop), so perhaps I'm missing the point but maybe try SETTRANSPARENCY -1 (shouldn't need to by default) before a LOADFONT, GRABSPRITE and LOADSPRITE. :rtfm:
I've never needed to use ALPHAMODE -1 for transparent PNG (exported from Photoshop), so perhaps I'm missing the point but maybe try [/quote]
it works here (as i recall) but without alphamode -1, I get a hard edge cut on the sprites (similar to single color mask).
with alpha mode -1 it respects the 256 shades of the alpha and so things get antialiased.
can you confirm that matchy?
alphamode gave me and a few friends a little trouble before a set was found to work as supposed.
He specifically stated he needed ALPHAMODE -1, so that's what I commented on. I've never had any trouble with .PNGs either, but there you go.
If you use alphachannels with more than 1 bit you will need alphamode. And you also have to set it in each loop I believe. It's not enough to set it at program start (if I remember right, too late to try it right now :-)
thanks ian and moru.
I saw what he asked, it is just that the setup we found + this discussion got some doubts on me on this off topic of mine,
I was to open a post regarding that and the setup that worked with us.
I will save it to when BATRAQUIOS ME MORDAM gets a little more complete and I can have a better general idea.
but it sure is on the ways moru said.
part of the problem was on the png generation on photoshop.
if it is single layer with transparency, it works, if I set up a proper alpha channel on the channels tab, it does not go into png.
Yeah.. maybe I'll do some more tests later but I have several functions which use drawing commands, and it almost seems like I have to call ALPHAMODE -1 in every function that draws.. maybe it's somehow tied to the current function's scope. hm I guess I could've just set it in global scope, maybe I'll play around a bit more later..
I think every showscreen resets it to zero. I just shove a -1 at the start of any graphics routine just incase. Would be nice to have a configurable default setting. Almost everything I use is -1 so would be useful.
Cheers
Yep, all ALPHAMODE commands revert back to 0.0 after SHOWSCREEN.