blob: 402be38bf7b5c7ecdfcbe0ecccf855f8363819fd [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;
14
15 // outputs
16 normal = n;
17 gl_TexCoord[0] = gl_TextureMatrix[0] * f;
18 gl_Position = ftransform();
19}