Advertisement
stirante

Untitled

Mar 30th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     // Sample from camera texture.
  3.     float y = texture2D(u_TextureY, v_TexCoordinate).r;
  4.     float cr = texture2D(u_TextureVU, v_TexCoordinate).r - 0.5;
  5.     float cb = texture2D(u_TextureVU, v_TexCoordinate).a - 0.5;
  6.  
  7.     float radius = distance(v_CircleCoordinate, vec2(0.0, 0.0));
  8.  
  9.     // This is 1.0 if in the circle, 0.0 if not.
  10.     float inCircle = float(radius < u_CircleRadius);
  11.  
  12.     // Convert to RGB color space.
  13.     float r = (y + 1.403 * cr) * inCircle;
  14.     float g = (y - 0.344 * cb - 0.714 * cr) * inCircle;
  15.     float b = (y + 1.773 * cb) * inCircle;
  16.  
  17.     gl_FragColor = vec4(r, g, b, inCircle);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement