Book Image

Libgdx Cross-platform Game Development Cookbook

Book Image

Libgdx Cross-platform Game Development Cookbook

Overview of this book

Table of Contents (20 chapters)
Libgdx Cross-platform Game Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Welcome to the world of shaders


Shaders are small computer programs that give us more control over what is rendered by letting us communicate more closely with the GPU. This is a broad field and cannot be possibly covered in great detail within this book's scope, but nonetheless, it's absolutely essential to graphics programming. We will try to provide some introductory guidelines so as to start working with them; you can later check the several shader programming-specific books available.

Throughout this and the following recipes, we will dig into OpenGL Shading Language (GLSL). As a first contact, we will postprocess an image by adding the grayscale, sepia, and inverted color filters.

Getting ready

Once more, make sure the sample projects are ready to be used in your Eclipse workspace.

Shader scripts are loaded at runtime. For this recipe, you will need the following files:

  • [cookbook]/samples/samples-android/assets/data/shaders/grayscale.vert

  • [cookbook]/samples/samples-android/assets/data...