Upcoming Events
VIEW Conference 2009
11/4 - 11/7 @ Turin, Italy

Project Horseshoe
11/5 - 11/8 @ Burnet, TX

Independent Game Conference West
11/5 - 11/6 @ Los Angeles, CA

IGDA Leadership Forum
11/12 - 11/13 @ San Francisco, CA

More events...


Quick Stats
7503 people currently visiting GDNet.
2337 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!



Link to us

Link to us

  search:   

Creating a GLSL Library


Conclusion

Hopefully this article will give you an idea of how to write shader libraries. With the enclosed libraries you could combine Lighting and Texturing into a single pass. You could change the lighting model from Phong to something else, such as Toon Shading. The possibilities with GLSL are enormous.

Just remember if you come up with something really cool to share with the rest of us. Thanks for reading.

References

GLSL Tutorial - Lighthouse3D August 2007
Lighting with GLSL : Phong Model - oZone3D.net August 2007
Per Fragment Lighting - ClockworkCoders August 2007
Rost, Randi J. OpenGL Shading Language 1st ed. Boston : Addison-Wesley, 2004

Useful Links

ShaderGen - Fixed Functionality Shader Generation Tool (used to emulate OpenGL texturing)
ShaderDesigner - A GLSL IDE available in the OpenGL SDK (used for development of the enclosed shaders)


Contents
  Introduction
  A Texturing Example
  A Multi-Texturing Example
  A One-Sided Per-Pixel Lighting Example
  The Phong Lighting Shader
  A Two-Sided Per-Pixel Lighting Example
  Conclusion

  Source code
  Printable version
  Discuss this article