GLBasic forum

Main forum => GLBasic - en => Topic started by: kaotiklabs on 2009-Nov-07

Title: DrawAnim corruption on iPhone
Post by: kaotiklabs on 2009-Nov-07
Hi,
I´m using a transition animation for ingame menus.
The animation uses all the screen, 480x320.

Works fine on Windows but on the iPhone the animation gets corrupted.
This is not the first time I get this behaviour on the iphone in landscape mode.

Usually drawing with drawsprite bypass the problem.
So I believe there´s some problem with loadanim/drawanim in landscape mode.

This sample reproduces the behaviour:

Code (glbasic) Select
SETSCREEN 480,320, TRUE

GLOBAL ANI_TRANSITION = 0
LOADANIM "Media/transition.png", ANI_TRANSITION, 480, 320


WHILE TRUE
GOSUB OpenTransition
MOUSEWAIT
WEND

SUB OpenTransition:
LOCAL done=FALSE
LOCAL timer
LOCAL i=0

WHILE done = FALSE
timer = timer + GETTIMER()
DRAWANIM ANI_TRANSITION, i, 0, 0
SHOWSCREEN

IF timer > 84
INC i, 1
timer = 0
ENDIF

IF i > 4 THEN done = TRUE
WEND
ENDSUB



The png is attached.

Any idea about what could be happening?



[attachment deleted by admin]
Title: Re: DrawAnim corruption on iPhone
Post by: matchy on 2009-Nov-07
The original image dimensions are 2400x320px. When this is resized to 1020x100 and 2 lines of code changed shows that 1023px width is the limit.
   LOADANIM "transition.png", ANI_TRANSITION, 204, 100
      STRETCHANIM ANI_TRANSITION, i, 0,0, 480,320

I suppose you could just tile anim plot it but what about poly map plot?
Title: Re: DrawAnim corruption on iPhone
Post by: kaotiklabs on 2009-Nov-07
sorry, but I don´t understand you.

is there a width limit of 1023px for load animations on iphone platforms??

Ok, I will try drawing with polys!
Title: Re: DrawAnim corruption on iPhone
Post by: doimus on 2009-Nov-07
Quote from: kaotiklabs on 2009-Nov-07
sorry, but I don´t understand you.

is there a width limit of 1023px for load animations on iphone platforms??

Yes there is a limit: all textures must be powers of two and preferably square, up to 1024x1024.
Title: Re: DrawAnim corruption on iPhone
Post by: codegit on 2009-Nov-07
Yes stick on or below 1024. Use 32, 64, 128, 512 etc. I have had no problems with these values and I use drawanim alot.   ;)
Title: Re: DrawAnim corruption on iPhone
Post by: kaotiklabs on 2009-Nov-07
Using polyvectors the problem remains so I have finally changed the image size and use stretch.
Now works. Thanks for the help!
Title: Re: DrawAnim corruption on iPhone
Post by: Kitty Hello on 2009-Nov-09
Why aren't you just storing 2 images and use drawsprite to move them toghether?
Title: Re: DrawAnim corruption on iPhone
Post by: codegit on 2009-Nov-09
Quote from: Kitty Hello on 2009-Nov-09
Why aren't you just storing 2 images and use drawsprite to move them toghether?

Also, this way you will be able to get much smoother animation, as all you movements are at pixel level.  8)
Title: Re: DrawAnim corruption on iPhone
Post by: kaotiklabs on 2009-Nov-09
Yes, is the simple solution but the 3d feeling will disappear due to shadows overlapping.
Eitherway, better simple than superscaled.
Title: Re: DrawAnim corruption on iPhone
Post by: Kitty Hello on 2009-Nov-09
draw all with alhamode -0.5, then with alphamode 0.0 and offset slightly to the left and up.