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

Drawing primitives using vertex buffers


VBO was, in the past, a part of an OpenGL as an extension. With the new OpenGL specification, the VBO mechanism is included in the GLSL specification. This means that you can reuse much of the existing functionality with small changes. VBOs present an opaque storage for data; therefore, they might contain the vertex positions, texture coordinates, colors or any other data. GLSL shaders can use these buffers but they must be differentiated so the shader program knows what data is stored inside of these buffers. That's where the vertex array objects or VAO come in. The vertex array object is a structure that merges VBOs for use in the shader program. They are used in GLSL shader programs as a main source of vertex attributes. Each of the attributes can be submitted in its own VBO. It ensures efficient upload of all vertices into graphic memory and you can easily add other vertices if needed.

You may find it desirable to use interleaved data format for...