Author Topic: Glbasic 11.414, sprite hole don't work  (Read 4806 times)

Offline Qedo

  • Dr. Type
  • ****
  • Posts: 382
  • to program what I have do how should programming?
    • View Profile
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

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 5116
  • O Rly?
    • View Profile
Re: Glbasic 11.414, sprite hole don't work
« Reply #1 on: 2013-May-19 »
SETTRANSPARENCY?
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

MrTAToad

  • Guest
Re: Glbasic 11.414, sprite hole don't work
« Reply #2 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.

Offline spicypixel

  • Prof. Inline
  • *****
  • Posts: 646
  • Pixel Artist
    • View Profile
    • SpicyPixel.net
Re: Glbasic 11.414, sprite hole don't work
« Reply #3 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.
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10851
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Glbasic 11.414, sprite hole don't work
« Reply #4 on: 2013-Oct-04 »
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.

Code: (glbasic) [Select]


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



Offline Qedo

  • Dr. Type
  • ****
  • Posts: 382
  • to program what I have do how should programming?
    • View Profile
Re: Glbasic 11.414, sprite hole don't work
« Reply #5 on: 2013-Oct-05 »
Great.
I'd try to understand the code
When the next beta release?
Thank you
Ciao

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10851
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Glbasic 11.414, sprite hole don't work
« Reply #6 on: 2013-Oct-07 »
Its already online. Go get it.

Sent from my GT-N7100 using Tapatalk 4


Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4450
    • View Profile
    • FUED
Re: Glbasic 11.414, sprite hole don't work
« Reply #7 on: 2013-Oct-07 »
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. ;)

Offline mrplant

  • Mr. Polyvector
  • ***
  • Posts: 233
    • View Profile
Re: Glbasic 11.414, sprite hole don't work
« Reply #8 on: 2013-Oct-13 »
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
« Last Edit: 2013-Oct-15 by mrplant »