Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Borders in sprite

Author
Message
Juande
12
Years of Service
User Offline
Joined: 2nd Sep 2011
Location:
Posted: 28th Jul 2012 16:28
Hi, I am doing a animated sprite (the opening of a door) in a backgroud. The backgroud has the same zone of the animated sprite but it's static.

When I put the animated sprite on the background, this sprite is correctly drawn in PC, but in Android, you can see a little black border.

My code is:


If I use setspritealpha, the border is removed but the animation is not played.

Where is the mistake?

Thanks
Juande
12
Years of Service
User Offline
Joined: 2nd Sep 2011
Location:
Posted: 28th Jul 2012 17:52 Edited at: 28th Jul 2012 17:58
I have tried other things. If you have a image with 256 colors, the border appears. If you have a image with transparency and it's rgb, the border doesn't appear.

I don't know why does border appear.
erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 28th Jul 2012 18:22
Can you attach the image in question so I can check it? (I'm better with graphics I may be able to tell if its an image problem vs code problem)
Juande
12
Years of Service
User Offline
Joined: 2nd Sep 2011
Location:
Posted: 28th Jul 2012 18:50
No problem! I send the scene (512*250) and the door(157*210)

Thanks for your time!

Attachments

Login to view attachments
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 28th Jul 2012 19:05
as a rule of thumb make sure that all your assets are sized as even number

157 x 210 is not good. try 158 x 210

also try setting

SetImageWrapU and SetImageWrapV to 0 and/or SetSpriteSnap to 1.
erebusman
12
Years of Service
User Offline
Joined: 23rd Jul 2011
Location: Sacramento, CA
Posted: 28th Jul 2012 23:48
@Juande

Okay I do not think its the images. I assumed you were using a transparent .PNG when you mentioned the problem when you toggled transparency flag -- but these images have no transparency in them so that is not the problem.

These images have the full background filled in with that blue gradient so its not the problem that I guessed.



What bjadams said above is true, make sure all your images are a power of 2 along both edges.

So 256x256 or 512x256 or 128x64 or 32x32 for instance or graphic cards have problems dealing with them and may compact, clip, resize or not be able to load them possibly.

I suppose its vaugely possible the android device is having to resize your graphics and causing some sort of issue around the edge ?? but I suspect it is something else.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 29th Jul 2012 10:43
i found out that power of 2 is not necessary if you are using single sprites and no spritesheets. making them even sized is important though.

this is not an agk thing, it's also a "rule" in others sdks i use.
Juande
12
Years of Service
User Offline
Joined: 2nd Sep 2011
Location:
Posted: 31st Jul 2012 19:44
bjadams, erebusman... I have try with 256x256 and it's the same... I am thinking the problem is my image editor. I will try others editors.

Thanks for your time and for your help.

Greetings!

Login to post a reply

Server time is: 2024-04-28 18:49:55
Your offset time is: 2024-04-28 18:49:55