UVCCamera_Texture_Shader.shader 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. Shader "UVCCamera_Texture_Shader"
  2. {
  3. Properties
  4. {
  5. }
  6. SubShader {
  7. Tags { "RenderType"="Opaque" }
  8. Pass
  9. {
  10. GLSLPROGRAM
  11. #pragma only_renderers gles3 gles
  12. // #ifdef SHADER_API_GLES3 cannot take effect because
  13. // #extension is processed before any Unity defined symbols.
  14. // Use "enable" instead of "require" here, so it only gives a
  15. // warning but not compile error when the implementation does not
  16. // support the extension.
  17. #extension GL_OES_EGL_image_external_essl3 : enable
  18. #extension GL_OES_EGL_image_external : enable
  19. #ifdef VERTEX
  20. //uniform mat4 texMatrix;
  21. void main()
  22. {
  23. gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
  24. gl_TexCoord[0] = gl_MultiTexCoord0;
  25. }
  26. #endif
  27. #ifdef FRAGMENT
  28. //#extension GL_OES_EGL_image_external : require
  29. precision mediump float;
  30. uniform samplerExternalOES texSampler;
  31. //varying vec2 texCoords;
  32. void main()
  33. {
  34. vec2 vc2 = gl_TexCoord[0].st;
  35. vc2.y = 1.0 - vc2.y;
  36. //vc2.x = 1.0 - vc2.x;
  37. gl_FragColor = texture2D(texSampler,vc2);
  38. }
  39. #endif
  40. ENDGLSL
  41. }
  42. }
  43. FallBack "Diffuse", 1
  44. }