Tiny Example Vertex & Fragment Shader programs Orion Sky Lawlor, olawlor@acm.org, 2005/2/9 (Public Domain) Building: On a Linux machine with the GLUT libraries, you should be able to type "make" and get a "main" executable. Anywhere else, you should be able to just compile "main.cpp" to get "main". Running: The fragment shader is loaded from "fragment.txt" every frame, so if you change fragment.txt while the program is running, it will immediately begin displaying the new version (as soon as the window is redrawn). The vertex shader is loaded from "vertex.txt". The default OpenGL vertex shader does *nothing*, not even transform the vertex position into clip coordinates; I always use a vertex shader that does this, plus sets up fragment.texcoord 4-7 to contain the world-coordinates position, normal, color, and eye direction. These are the basics you need to do any sort of shading and lighting computation; and you can use the same vertex shader for everything.