Yet this shader code is made for directional lights only. It does not compute difference between light position and vertex position (with correctly applied transformations), which it would have to, if it was to actually do point lights.Argh wrote:1. It's not a directional light, it's a point light, with the position treated as the vector for the resulting rays, per vertex.
Actually you're already rendering every unit multiple times for each light, no? You can set up blending and have it add up, however that'll really sux performance-wise.2. Yes, it handles exactly one light at present, but I'm still deciding how to go about additive stuff efficiently. I don't suppose you have a magic solution for that?
Alternatively you can learn some opengl and see that the default "shader" supplied by opengl implementation does almost same thing as this copypasted shader. Or you can learn some glsl, some mathematics, and actually write a shader.
A shader is a sort of program code. It is tad more complex than a texture image that you can grab somewhere and use.
In further contributions, I'd recommend commenting where the code was taken from. I'll be both easier for you later on (suppose you forget exact URL), and clearer for others. Copy-paste programming fails.
3. The GLSL shader is based on the basic vertex shader from Typhoon Labs' GLSL course, Chapter 3, and is pretty much used verbatim, except for one little thing which I did that you can figure out yourselves by comparing sources- it's not like it's a lot of code or anything