Hi,
I hope nvidia guys are reading this forum, because I’ve experienced a crash in glCompileShader, will testing interface blocks.
Perhaps my shader (vertex and fragment, no geometry) are not correct, but I expect some error message ;).
Here they are :
#version 150 core
in vec3 position;
in vec3 normal;
uniform transform
{
mat4 projection;
mat4 view;
mat4 model;
}
out lighting
{
vec3 N;
vec3 L;
vec3 V;
}
uniform vec3 lightDir;
void main()
{
mat3 normalMatrix = mat3(view * model);
vec3 pos = vec3(view * model * vec4(position, 1.));
N = normalize(normalMatrix * normal);
L = mat3(view) * -lightDir;
V = -pos;
gl_Position = projection * view * model * vec4(position, 1.);
}
#version 150 core
in lighting
{
vec3 N;
vec3 L;
vec3 V;
} lighting;
const vec3 ambient = vec3(0.1);
const float shininess = 100.;
void main()
{
vec3 L = normalize(lighting.L);
vec3 V = normalize(lighting.V);
vec3 N = normalize(lighting.N);
vec3 R = reflect(-L, N);
float diffuse = max(dot(L, N), 0.);
float specular = max(pow(dot(normalize(V), R), shininess), 0.);
vec3 color = vec3(diffuse + specular);
gl_FragColor = vec4(ambient + color, 1.);
}
Thanks.
ps:
I’m under ubuntu 9.04 2.6.28-15-generic 64 bits kernel, with a gf9800gt.