this simple program work correctly in GlBasic 10.283 and creates a sprite hole, while don't work in Glbasic 11.414 (see the picture)
Any idea?
Ciao
id% = GENSPRITE()
// Create virtual screen
CREATESCREEN 1,id%,32,32
USESCREEN 1
DRAWRECT 0,0,31,31,RGB(255,255,255) // white background os the sprite
DRAWRECT 4,4,24,24,RGB(255,0,128) // transparent hole in the sprite
USESCREEN -1
DRAWRECT 100,100,70,70,RGB(255,0,0) // draw the red background
DRAWSPRITE id%,120,120 // draw the sprite
SHOWSCREEN
MOUSEWAIT
SETTRANSPARENCY?
SETTRANSPARENCY doesn't work with screens (been mentioned before).
I suspect the problem is that it shouldn't have worked in V10 - RGB(255,0,128) is the default transparency level and really it shouldn't have created the hole.
Quote from: MrTAToad on 2013-May-19
SETTRANSPARENCY doesn't work with screens (been mentioned before).
I suspect the problem is that it shouldn't have worked in V10 - RGB(255,0,128) is the default transparency level and really it shouldn't have created the hole.
If you're drawing something transparent then it simply won't appear, makes sense.
ok, fixed in the next beta release.
Now read this carefully!
GLBasic V11+ defaults to: ALPHATESTING 1; ALPHAMODE -1;
That's faster than cookie cutting on mobile devices. If, however, you do alphamode 0 now, you WILL SEE PINK AREAS! Always do ALPHAMODE -1 - OR - do ALPHATESTING 0.05 to get the old V10 behaviour.
LOCAL id% = GENSPRITE()
// Create virtual screen
CREATESCREEN 1,id%,32,32
USESCREEN 1
DRAWRECT 0,0,31,31,RGB(255,255,255) // white background os the sprite
ALPHATESTING 1 // no cookie cut
ALPHAMODE 0 // no blending
DRAWRECT 4,4,24,24,RGB(255,0,128) // transparent hole in the sprite
USESCREEN -1
DRAWRECT 100,100,70,70,RGB(255,0,0) // draw the red background
ALPHAMODE -1 // blend cookie holes, totally (same but faster than alphatesting .05)
DRAWSPRITE id%,120,120 // draw the sprite
SHOWSCREEN
MOUSEWAIT
END
Great.
I'd try to understand the code
When the next beta release?
Thank you
Ciao
Its already online. Go get it.
Sent from my GT-N7100 using Tapatalk 4
Super great news Gernot! As I understand, we can now draw with transparencies, something I was looking forward for quite some time. :good: :) :nw:
It will be a little while before I try newer betas (moving house and all that) but it is really exciting news!
edit: sorry thread hijack, but this issue was an old one throughout discussed before the dawn of time. ;)
Alphamode related - I have a white screen graphic with company logo on it which I fade slowly in and then out again at the start of my game. Here is the code.
On iOS - with the latest 11.559 beta, this code looks fine. On MAC and Windows platforms however, it sort of flickers and shimmers up and down the image as it fades... Any ideas?
Edit: It is as if VSYNC is disabled as it is like seeing refresh lines?
// Fade in the intro screen.
FOR LoopX=-0.01 TO -1.0 STEP -0.025
ALPHAMODE LoopX
UDrawSprite (gIntro,0,0)
// The following code is compiled for iOS Platform only:
?IFDEF IPHONE
IOSAutoOrient() // If running on iOS, check for a screen orientation change and flip as required.
?ENDIF
SHOWSCREEN // Copy whats on Backbuffer to main screen.
NEXT
ALPHAMODE -1.0
UDrawSprite (gTSPresents,0,0)
SHOWSCREEN // Copy whats on Backbuffer to main screen.
SLEEP (600) // Slight delay at full brightness
// Fade out the intro screen.
FOR LoopX=-1.0 TO -0.01 STEP 0.025
ALPHAMODE LoopX
UDrawSprite (gTSPresents,0,0)
// The following code is compiled for iOS Platform only:
?IFDEF IPHONE
IOSAutoOrient() // if running on iOS, check for a screen orientation change and flip as required.
?ENDIF
SHOWSCREEN // Copy whats on Backbuffer to main screen.
NEXT