oculus1

view sdr/phong.p.glsl @ 29:9a973ef0e2a3

fixed the performance issue under MacOSX by replacing glutSolidTeapot (which uses glEvalMesh) with my own teapot generator.
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 27 Oct 2013 06:31:18 +0200
parents
children
line source
1 varying vec3 vpos, norm, ldir;
3 void main()
4 {
5 vec3 v = -normalize(vpos);
6 vec3 n = normalize(norm);
7 vec3 l = normalize(ldir);
8 vec3 h = normalize(v + l);
10 float ndotl = max(dot(n, l), 0.0);
11 float ndoth = max(dot(n, h), 0.0);
13 vec3 diff = gl_FrontMaterial.diffuse.rgb * gl_LightSource[0].diffuse.rgb * ndotl;
14 vec3 spec = gl_FrontMaterial.specular.rgb * gl_LightSource[0].specular.rgb *
15 pow(ndoth, gl_FrontMaterial.shininess);
17 gl_FragColor.rgb = diff + spec;
18 gl_FragColor.a = 1.0;
19 }