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

Loading and using GLSL shaders

Shader programs must be compiled before use. Fortunately, OpenGL offers an interface to load shader programs in text form. The shader source code uses a syntax similar to the C code with several limitations. For instance, you can't perform recursive function calls. After compilation, you can check whether there were any errors in the process.

Shaders can use input values from your application. These input values are called uniforms. You can use these values in any part of the rendering pipeline, which consists of several shader program stages:

  • Vertex shader: This performs operations on vertex attributes: vertex color, position, normal vector and many others
  • Tessellation control shader: This controls tessellation amount ...

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