Book Image

Sparrow iOS Game Framework Beginner's Guide

By : Johannes Stein
Book Image

Sparrow iOS Game Framework Beginner's Guide

By: Johannes Stein

Overview of this book

Table of Contents (20 chapters)
Sparrow iOS Game Framework Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Afterword
Index

Learning about texture formats


So far, we only used PNG images. However, let's see if there are any other texture formats in iOS that would better fit our purpose. Spoiler: there are. Leaving the brash remark aside, we are going to analyze which texture formats fits our purpose best.

The following table shows the pirate ship image in different file formats. Let's compare its file sizes:

Compression

File format

File size

None

BMP

257 KB

Lossless

PNG

36.6 KB

Depends

PVR

(In this case RGBA8888)

257 KB

When we load a PNG file, what happens internally? The image gets decompressed when it's being loaded—at the expense of the CPU. The same goes for other conventional image formats such as JPEG. Once the image is decompressed, it becomes a texture.

PVR is a texture format specifically optimized for iOS devices or for PowerVR GPUs used on all iOS devices, to be more precise. When loading a PVR image, for example, it will decode the image directly on the GPU instead of the CPU.

PVR includes...