dungeon_crawler
view prototype/sdr/mrt.p.glsl @ 27:cbf86e5198a9
fized the vbo state creep
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 25 Aug 2012 14:37:51 +0300 |
parents | 8a0ae6b4aa9b |
children | 0357994effe2 |
line source
1 /* MRT assignments
2 * 0 - RGB: position
3 * 1 - RGB: normal
4 * 3 - RGB: diffuse color, A: shininess str.
5 * 4 - unused
6 */
8 uniform sampler2D tex_dif, tex_norm;
10 varying vec3 pos, norm;
12 void main()
13 {
14 vec3 n = normalize(norm);
16 vec4 texel = texture2D(tex_dif, gl_TexCoord[0].st);
17 vec3 diffuse = (gl_FrontMaterial.diffuse * texel).xyz;
18 vec3 spec = gl_FrontMaterial.specular.xyz;
19 float sstr = (spec.x + spec.y + spec.z) / 3.0;
21 gl_FragData[0] = vec4(pos, 0.0);
22 gl_FragData[1] = vec4(norm, 0.0);
23 gl_FragData[2] = vec4(diffuse, sstr);
24 gl_FragData[3] = vec4(0.0, 0.0, 0.0, 0.0);
25 }