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

Setting up lighting

The fixed pipeline of OpenGL allows you to set up simple lighting. This lighting system is mostly used for static scenes with a few light sources. This is mostly because it has a few limitations:

  • OpenGL guarantees that there are at least eight light sources available.
  • It only supports Gouraud shading—vertex color interpolation
  • There are predefined equations for normal mapping and attenuation. You can only change a few parameters.

If you're okay with these limitations, you can use this lighting system without the need of CPU-computed lighting or GPU shaders. Games such as Quake and Quake 2 use vertex colors and light map textures to compute lighting on CPU, which is expensive, but these games use certain tricks to keep the performance ...

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