GLBasic forum

Main forum => GLBasic - en => Topic started by: AndyH on 2008-Mar-29

Title: Question about images with an alpha channel
Post by: AndyH on 2008-Mar-29
Here's the image:

(http://baa.ovine.net/achannel.png)


and here's some code:

Code: (glbasic) [Select]
SETSCREEN 640,480,0
LIMITFPS 60

BLACKSCREEN

LOADSPRITE "achannel.png",0

WHILE TRUE
LOCAL x,y,a,b

IF KEY(2) THEN ALPHAMODE -1
IF KEY(3) THEN ALPHAMODE 1

DRAWRECT 105,105,100,10, RGB(0,0,255)

MOUSESTATE x,y,a,b
DRAWSPRITE 0, x,y

DRAWSPRITE 0,100,100

SHOWSCREEN

WEND
By default, the alpha channel on the red circle is ignored.  If shows a solid circle.  Hold 1 on the keyboard to apply the alphamode of -1 and the alpha channel works.  Is this correct or should alphamode 0 also work?
Title: Question about images with an alpha channel
Post by: Schranz0r on 2008-Mar-29
All correct ;)
Alphamode 0 is No Alpha !
Title: Question about images with an alpha channel
Post by: Kitty Hello on 2008-Mar-31
Right Alphamode 0 just uses all alpha above 0.5 as transparent. If you want it blended, use ALPHAMODE -1
For a glow effect ALPHAMODE -.7 or something. Or even +.5.