Sprites and alpha modes on the GP2X

Previous topic - Next topic

BasicMe

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

BumbleBee

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
The day will come...

CPU Intel(R) Core(TM) i5-3570k, 3.4GHz, AMD Radeon 7800 , 8 GB RAM, Windows 10 Home 64Bit

BasicMe

I'm using 5.165.  I have Live Update set to "check daily."  :)

XaMMaX

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
Sry for my english

XaMMaX

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
Sry for my english

Kitty Hello


BasicMe


Kitty Hello


XaMMaX

Corrupt still in my game. I use 5.173
Sry for my english

Kitty Hello


BasicMe

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.  :(

Kitty Hello


BasicMe

Yes, that fixed it!  Both my test code, as well as my actual game program, are now showing the graphics perfectly!

Thanks, Gernot!