FragShader.fsh 375 B

12345678910111213141516171819
  1. uniform sampler2D s2DMap;
  2. uniform samplerCube sCubeMap;
  3. uniform bool bCubeReflection;
  4. varying mediump vec3 ReflectDir;
  5. void main()
  6. {
  7. // select whether to use cube map reflection or 2d reflection
  8. if(bCubeReflection)
  9. {
  10. gl_FragColor = textureCube(sCubeMap, ReflectDir);
  11. }
  12. else
  13. {
  14. gl_FragColor = texture2D(s2DMap, ReflectDir.xy * 0.5 + 0.5);
  15. }
  16. }