SHARE
TWEET

Untitled

a guest Jan 29th, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. varying vec2 v_texCoord;
  2. uniform vec2 rubyTextureSize;
  3. uniform vec2 rubyInputSize;
  4. uniform vec2 rubyOutputSize;
  5.  
  6. #if defined(VERTEX)
  7. attribute vec4 a_position;
  8.  
  9. void main() {
  10.   vec2 ratio = max(floor((rubyOutputSize+0.0001)/rubyInputSize), 1.0);
  11.   vec4 clean = vec4(ratio*rubyInputSize/rubyOutputSize, 1.0, 1.0);
  12.  
  13.   gl_Position = a_position * clean;
  14.   v_texCoord = vec2(a_position.x+1.0,1.0-a_position.y)/2.0*rubyInputSize;
  15. }
  16.  
  17. #elif defined(FRAGMENT)
  18. uniform sampler2D rubyTexture;
  19.  
  20. void main() {
  21.   gl_FragColor = texelFetch(rubyTexture, ivec2(v_texCoord), 0);
  22. }
  23. #endif
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top