You might be interested in having a look at ShaderGen. From the description:
ShaderGen is a program that can automatically produce shaders that mimic the results of a set of fixed function state. This tool was used to verify the fixed function shader code that is described in Chapter 9.
By the way, you will most likely encounter subtle driver problems if you mix fixed function and GLSL. This is not the "most used way" to do shading so it has a good change of having bugs (at least it did when I tried it). If what you need works, great! Otherwise, you're likely much better off writing the vertex and fragment shaders in GLSL. From what I heard, the driver of modern GPUs uses shaders under the hood anyway to do fixed function.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…