GLBasic forum

Main forum => Bug Reports => Topic started by: BasicMe on 2008-Feb-10

Title: Sprites and alpha modes on the GP2X
Post by: BasicMe on 2008-Feb-10
When compiling for the GP2X:

If a sprite clips the top of the screen, AND it is being drawn using any alpha mode other than 0, the sprite becomes corrupt.  Using alpha mode of 0 works fine.

To see this in action, try the code below.  Use the joystick up and down to move the sprites off the top of the screen.

Code (glbasic) Select
DRAWRECT 0, 0, 8, 32, RGB(255, 0, 0)
DRAWRECT 8, 0, 8, 32, RGB(255, 255, 0)
DRAWRECT 16, 0, 8, 32, RGB(0, 255, 0)
DRAWRECT 24, 0, 8, 32, RGB(0, 128, 255)
DRAWLINE 0, 0, 31, 31, RGB(0, 0, 0)
DRAWLINE 1, 0, 31, 30, RGB(0, 0, 0)
DRAWLINE 0, 1, 30, 31, RGB(0, 0, 0)
DRAWLINE 0, 31, 31, 0, RGB(0, 0, 0)
DRAWLINE 0, 30, 30, 0, RGB(0, 0, 0)
DRAWLINE 1, 31, 31, 1, RGB(0, 0, 0)
GRABSPRITE 0, 0, 0, 32, 32

x=24
y=10
z=0

WHILE z=0
  DRAWRECT 0, 0, 320, 240, RGB(64, 64, 64)
  PRINT "   ALPHA MODES:", 0, 60
  PRINT "   -1.0  -0.5   0.0   0.5   1.0", 0, 80
  PRINT "   press SELECT to quit", 0, 200
 
  IF KEY(200) THEN y=y-1
  IF KEY(208) THEN y=y+1
  IF y<-32 THEN y=-32
  IF y>10 THEN y=10
  IF KEY(15) THEN z=1
 
  FOR g=0 TO 4
    ALPHAMODE (g/2)-1
    DRAWSPRITE 0, x+(g*50), y
  NEXT
 
  SHOWSCREEN
WEND
Title: Sprites and alpha modes on the GP2X
Post by: BumbleBee on 2008-Feb-10
Hi
I can't test it because i ain't got that GP2X.:D It would be good to know what GLBasic version you have. It's often hard to understand, if we (Gernot) don't know it. Latest is 5.165. Updates coming fast.  

Cheers
Title: Sprites and alpha modes on the GP2X
Post by: BasicMe on 2008-Feb-10
I'm using 5.165.  I have Live Update set to "check daily."  :)
Title: Sprites and alpha modes on the GP2X
Post by: XaMMaX on 2008-Feb-10
I try it on my gp2x f100 and it corrupt for me too(then i press up), but i use alphamode in my game for gp2x without some kind of corrupt. I am not shure, but try not using sprite that you grab from grabsprite... but this is just assumption
Title: Sprites and alpha modes on the GP2X
Post by: XaMMaX on 2008-Feb-10
I was wrong, i just try my game on gp2x and it have same corrupt (( And i am not using grabsprite. Please fix this bug before end of gp2x comp
Title: Sprites and alpha modes on the GP2X
Post by: Kitty Hello on 2008-Feb-11
Uh-Oh. I'm fixing it.
Title: Sprites and alpha modes on the GP2X
Post by: BasicMe on 2008-Feb-11
Thanks Gernot! :good:
Title: Sprites and alpha modes on the GP2X
Post by: Kitty Hello on 2008-Feb-14
Might be fixed now.
Title: Sprites and alpha modes on the GP2X
Post by: XaMMaX on 2008-Feb-15
Corrupt still in my game. I use 5.173
Title: Sprites and alpha modes on the GP2X
Post by: Kitty Hello on 2008-Feb-17
The above example?
Title: Sprites and alpha modes on the GP2X
Post by: BasicMe on 2008-Feb-17
Yes, it's still corrupt for me as well.  I've also updated to 5.173, and I recompiled the same code that I submitted in my first post.  :(
Title: Sprites and alpha modes on the GP2X
Post by: Kitty Hello on 2008-Feb-17
Thank you, it's fixed.
Title: Sprites and alpha modes on the GP2X
Post by: BasicMe on 2008-Feb-18
Yes, that fixed it!  Both my test code, as well as my actual game program, are now showing the graphics perfectly!

Thanks, Gernot!