Hi,
The code is very simple and i don’t understand why it don’t work :
i use a 1d texture for the shading, and there aren’t any error at compilation (i use renderMonkey 1.6)
the vertex shader
varying vec3 normal ;
varying vec4 lightVector ;
void main(void)
{
normal = gl_NormalMatrix * gl_Normal;//to transform in eye coordinates
lightVector = normalize(gl_LightSource[0].position) ;
gl_Position = ftransform();//gl_ModelViewProjectionMatrix * gl_Vertex ;
}
the fragment shader :
varying vec3 normal ;
varying vec4 lightVector ;
uniform sampler1D hTex;//a handle for accessing a 1D texture
float intensity ;
vec4 color ;
void main(void)
{
intensity = max(dot (normal, lightVector.xyz), 0.0);
//texture1D access to a texture's pixel
color = texture1D(hTex, intensity);//intensity is the texture coordinate
//color computation
gl_FragColor = color ;
}