Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reflect.vert 413B

1234567891011121314151617181920
  1. // Vertex shader for cube-texture reflection mapping
  2. // Brian Paul
  3. varying vec3 normal;
  4. void main()
  5. {
  6. vec3 n = gl_NormalMatrix * gl_Normal;
  7. vec3 u = normalize(vec3(gl_ModelViewMatrix * gl_Vertex));
  8. float two_n_dot_u = 2.0 * dot(n, u);
  9. vec4 f;
  10. f.xyz = u - n * two_n_dot_u;
  11. f.w = 1.0;
  12. // outputs
  13. normal = n;
  14. gl_TexCoord[0] = gl_TextureMatrix[0] * f;
  15. gl_Position = ftransform();
  16. }