per pixel lighting using fragment program

I’m thinking of using the GL_ARG_fragment_program extension to do per pixel lighting. The idea seems straight forward, but I need the normal to do the maths, and the normal is a vertex attribute, not a fragment. So how can I code it?

BTW, if anybody knows a web site where I could find good vertex and fragment programs using the ARB extensions, that would be usefull.


If you want to access the normal in the fragment shader, just write it to one of your texcoord outputs in the vertex shader (after transforming it into the correct space).

That sounds like a cool idea. I’ll try that! :slight_smile: