Upcoming Events
Southwest Gaming Expo
11/20 - 11/22 @ Dallas, TX

Workshop on Network and Systems Support for Games (NetGames 2009)
11/23 - 11/25 @ Paris, France

ICIDS 2009 Interactive Storytelling
12/9 - 12/11 @ Guimarães, Portugal

Global Game Jam
1/29 - 1/31  

More events...


Quick Stats
6283 people currently visiting GDNet.
2341 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!



Link to us

Link to us

  Intel sponsors gamedev.net 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