Book Image

Lua Game Development Cookbook

By : Mario Kasuba, Mário Kašuba
Book Image

Lua Game Development Cookbook

By: Mario Kasuba, Mário Kašuba

Overview of this book

Table of Contents (16 chapters)
Lua Game Development Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Creating texture atlas with the rover-design pattern


Texture management becomes important with increasing the number of textures. An intuitive approach of using different OpenGL texture objects for each game texture presents the major bottleneck with rapid texture switching. That's because every time you change active texture unit, the graphic card needs to change its internal state. This problem can be eliminated using fewer larger textures that contain smaller images. This can be compared to a texture atlas where images are placed next to each other. These images can be accessed using different texture coordinates for every image.

Texture atlas can use evenly-spaced images with the same size or use some placement algorithm to place images of unequal sizes efficiently.

The first method was used in older games and is often used in games in which the images have the same size. Such texture atlas is often pregenerated to save the game loading time. Every time the game needs to use a different...