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 / Texture atlases

Author
Message
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 30th Dec 2011 17:51
Reading from FAQ section:
"...
Yes, sprites will be drawn together wherever possible and in depth order. This means that the use of texture atlases can greatly improve the performance of your app."

Could you be more specific because I am not s so experienced?

Thanks in advance
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Dec 2011 21:15
When using an Atlas, it's one image shared amongst many sprites. Each sprite uses a small part of the atlas (e.g 10 letters to form a word from one atlas image). Because it's one image, it can render much faster.

Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 1st Jan 2012 18:09 Edited at: 1st Jan 2012 18:12
An Atlas image is a picture file which contains several smaller images and a text file with coordinates of those tiles.

For example, if you have a 256x256 image called "tiles.png", which contains a 2 x 2 grid of smaller pictures (128 x 128 pixels), then you would have a 2nd file called "tiles subimages.txt" which contains;

Here, the first column is the name of the subimage, which can be any name but it is often easier to use numbers so they can be loaded with a loop.

The second and third columns contain the x and y coordinates of the top left corner of the sub image, the fourth and fifth contain the x and y size of that subimage.

In this case a neat grid of images which are the same size, though they do not need to be in a grid or even the same size

To use, load the main image as normal with something like;

the sub images can then be loaded, in this case using a simple loop, storing their pointers in an array;

Now even though you have pointers to five images, only one (the main one) actually uses any memory, the other four simply refer to that main image.

All this is done internally within AppGameKit , you just treat them like any other image.

Just be careful if you plan to do texture manipulation, such as UV scrolling as Atlas files come with some limitations.

But as they used to say on "Mr Ben", that's another story
george++
AGK Tool Maker
16
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 1st Jan 2012 19:11
Oh, I see
Thanks a lot!

Login to post a reply

Server time is: 2024-04-19 00:34:01
Your offset time is: 2024-04-19 00:34:01