blob: e1f22def339b3b2fc68e3d997f84b0ef329b66ff [file] [log] [blame]
Brianedf24e62007-02-03 11:36:16 -07001// Vertex shader for cube-texture reflection mapping
2// Brian Paul
3
4
5varying vec3 normal;
6
7void main()
8{
9 vec3 n = gl_NormalMatrix * gl_Normal;
10 vec3 u = normalize(vec3(gl_ModelViewMatrix * gl_Vertex));
11 float two_n_dot_u = 2.0 * dot(n, u);
12 vec4 f;
13 f.xyz = u - n * two_n_dot_u;
Brian Paul6ff1a532009-07-09 13:59:03 -060014 f.w = 1.0;
Brianedf24e62007-02-03 11:36:16 -070015
16 // outputs
17 normal = n;
18 gl_TexCoord[0] = gl_TextureMatrix[0] * f;
19 gl_Position = ftransform();
20}