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 / tips for animating swapping images on a plane teir 1

Author
Message
ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 12th Dec 2016 14:00
The only way I can see to do it is actually just preload the images (say 1 to 20) and then keep using setobjectimage... Is this the best way?
I don't see any way to us an image atlas...


CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 12th Dec 2016 15:48
I guess you could render an animated sprite to an image, and then use that image as the texture on your plane?
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 12th Dec 2016 16:09
Or use a video?
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 12th Dec 2016 16:38
Loading all the images and using SetObjectImage would be the best way, although if you can fit them all on a texture atlas and load the images with LoadSubImage then that would be even faster. Just be careful about how much memory loading all the images would take, for example 10 images 2048x2048 in size would use 160MB of memory (2048*2048*4(bytesPerPixel)*10(numImages)).
ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 13th Dec 2016 11:15
Hey thanks...

just to follow up say I use 20 images 256 x 256

any way to check the amount of memory I am using and -- generally don't go over how much memory to use?

I did already load 1 of these images and made 50 sprites and put them at -100,-100 I am guessing that does not take as much memory...
ICERGB
21
Years of Service
User Offline
Joined: 8th Nov 2002
Location: Canada
Posted: 13th Dec 2016 11:16
Hey thanks...

just to follow up say I use 20 images 256 x 256

any way to check the amount of memory I am using and -- generally don't go over how much memory to use?

I did already load 1 of these images and made 50 sprites and put them at -100,-100 I am guessing that does not take as much memory...
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 13th Dec 2016 15:48
A 256x256 image would take 256*256*4 bytes in memory which is 256KB, so 20 of them would use just over 5MB, which is no problem. Using a single image on 50 sprites is also no problem as they all share the same image and sprites themselves use much less memory compared to images.

Login to post a reply

Server time is: 2024-09-29 21:23:40
Your offset time is: 2024-09-29 21:23:40