GLBasic forum

Main forum => GLBasic - en => Topic started by: Hark0 on 2010-Aug-17

Title: Strange error sprites stretch only on iPhone (iPad OK)
Post by: Hark0 on 2010-Aug-17
Hi!

I detect a problem in the painting of Sprites. This is a "error" that only happens on my iPhone 3G 16Gb, in the case of the iPad 32Gb, no problem.


I explain my procedure for paint and the error observed:

First of all I load and image using LOADSPRITE. The image has 1280x480(x256) pixels, PNG format.
My idea is to use this image for "tutorial screen's", separated on 4 "pages" (1280/4=320 pixels).

I paint the image at 0,0 position for "first page". Wait tap and change the X position for show the "second page"... painting image at -320,0 pixels...

Well, please view the images and the strange stretch observed on iPhone (image appears as DOUBLE of horizontal size) . Other platforms such iPad, Win32... works perfectly.

Any idea?

 :blink:

TIA, Hark0

P.S. You can view a video sample on iPad of my project in my blog... without any sprite error.



[attachment deleted by admin]
Title: Re: Strange error sprites stretch only on iPhone (iPad OK)
Post by: Slydog on 2010-Aug-17
Weird!
Does it still do that if you use 'LOADANIM' and 'DRAWANIM' specifying the 'page' number as the animation frame?

Is the iPad version of the app in native iPad mode (4x the resolution), or simulated iPhone mode (stretched)?

[Edit]
I see by your iPad image dimensions that it is probably in 320x480 mode.
Title: Re: Strange error sprites stretch only on iPhone (iPad OK)
Post by: Ozden79 on 2010-Aug-18
You have passed the limit of 1024x1024 texture size which causes this weird behavior. I had experienced the same. You might ask why it works on IPad as it has 2048x2048 limit ;).
Title: Re: Strange error sprites stretch only on iPhone (iPad OK)
Post by: Hark0 on 2010-Aug-18
hmmm...

Thanks to both for the comments.

@Slydog: The images are captured directly on the devices... first iPhone, second iPad. I need SOME graphics for my project... this is because I use one PNG for various "pages".

@Ozden79: I think too this is the problem. Maybe I try PNG with only "2 pages". (My initial idea are create a PNG with more than "10 pages").

Interesting question: Where is the size+profundity color of the images for use??? Depends of RAM?

H.
Title: Re: Strange error sprites stretch only on iPhone (iPad OK)
Post by: Ozden79 on 2010-Aug-18
The texture size limit depends on device generation as far as I know and not something related with RAM or something. 3GS and above has 2048x2048 where the older one has 1024x1024. To overcome this limit, you need to load multiple textures using LOADANIM and choose the right one to draw depending on your image index on your code.
Title: Re: Strange error sprites stretch only on iPhone (iPad OK)
Post by: Hark0 on 2010-Aug-18
... you need to load multiple textures using LOADANIM and choose the right one to draw depending on your image index on your code.

Yes, I think this is the best solution. :)