Vertex shader
Code :
uniform vec3 v_origin;
uniform vec3 l_origin;
varying vec2 texCoord;
varying vec3 light;
varying vec3 lighthalf;
varying vec3 atcoord;
void main(void) {
	texCoord = vec2(gl_TextureMatrix[0] * gl_MultiTexCoord0);
	vec3 lightMinusPos = l_origin - gl_Vertex.xyz;
	light.x = -dot(lightMinusPos, gl_MultiTexCoord1.xyz);
	light.y = -dot(lightMinusPos, gl_MultiTexCoord2.xyz);
	light.z = -dot(lightMinusPos, gl_MultiTexCoord3.xyz);
	vec3 viewMinusPos = v_origin - gl_Vertex.xyz;
	lighthalf.x = -dot(viewMinusPos, gl_MultiTexCoord1.xyz);
	lighthalf.y = -dot(viewMinusPos, gl_MultiTexCoord2.xyz);
	lighthalf.z = -dot(viewMinusPos, gl_MultiTexCoord3.xyz);
	atcoord = vec3(gl_TextureMatrix[1] * gl_Vertex);
	gl_Position = ftransform();
}
fragment shader
Code :
uniform sampler2D basetex;\n"
uniform sampler2D normaltex;\n"
uniform sampler2D speculartex;\n"
uniform sampler3D attenuationtex;\n"
uniform vec3 lightColor;\n"
varying vec2 texCoord;\n"
varying vec3 light;\n"
varying vec3 lighthalf;\n"
varying vec3 atcoord;\n"
void main(void) {
	vec3 color = vec3(texture2D(basetex, texCoord));
	vec3 surfacenormal = -1.0 + 2.0 * vec3(texture2D(normaltex, texCoord));
	color *= max(dot(normalize(light), surfacenormal), 0.0);
	vec4 specular = texture2D(speculartex, texCoord);
	color += specular.xyz * pow(max(dot(vec3(normalize(lighthalf)), surfacenormal), 0.0), specular.a);
	vec4 attenuation = vec4(texture3D(attenuationtex, atcoord));
	gl_FragColor = vec4(attenuation.a * color  *lightColor, 1);
}
loading the program
Code :
	lightpass_program = R_Program_Compile(1, &internal_lightpass_fsh, 1, &internal_lightpass_vsh);
	qglUseProgramObjectARB(lightpass_program);
 
	qglUniform1iARB(qglGetUniformLocationARB(lightpass_program, "basetex"), 0);
	qglUniform1iARB(qglGetUniformLocationARB(lightpass_program, "normaltex"), 1);
	qglUniform1iARB(qglGetUniformLocationARB(lightpass_program, "speculartex"), 2);
	qglUniform1iARB(qglGetUniformLocationARB(lightpass_program, "attenuationtex"), 3);
 
	qglUseProgramObjectARB(0);
using the program:
Code :
	qglUseProgramObjectARB(lightpass_program);
 
	qglUniform3fARB(qglGetUniformLocationARB(lightpass_program, "v_origin"), r_origin[0], r_origin[1], r_origin[2]);
	qglUniform3fARB(qglGetUniformLocationARB(lightpass_program, "l_origin"), dl->sorigin[0], dl->sorigin[1], dl->sorigin[2]);
	qglUniform3fARB(qglGetUniformLocationARB(lightpass_program, "lightColor"), dl->color[0], dl->color[1], dl->color[2]);
anyway, when i use the program everything is slow and there doesnt seem like htere is a logical reason why. also everything is black even though blend is on with GL_ONE, GL_ONE