O'Reilly logo

Lua Game Development Cookbook by Mário Kašuba

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating surfaces

Surfaces are an object representation of image data buffers. They play the main role in the texture management process. Every image you load needs to be placed onto the surface first. After this, you can use this surface to render your image onto the screen, store it into graphical memory, or do some image manipulation.

Getting ready

Every surface consists of a pixel format description and binary data. The surface object structure is shown in the following table:

Field names

Description

flags

This is the bit mask description of surface properties.

format

This is the surface pixel format.

w

This is the surface width in pixels.

h

This is the surface height in pixels.

pitch

This is the length of the surface scanline ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required