Advertisement
Guest User

Untitled

a guest
Apr 19th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. "float map(float val, float A, float B, float a, float b) \n"
  2. "{ \n"
  3. " return (val - A) * (b - a) / (B - A) + a; \n"
  4. "} \n"
  5. " \n"
  6. "void main() \n"
  7. "{ \n"
  8. " vec4 ndc = VP * M * vec4(position, 1); \n"
  9. " \n"
  10. " gl_Position = ndc; \n"
  11. " float u = map(ndc.x / ndc.w, -1, 1, 0, 1); \n"
  12. " float v = map(ndc.y / ndc.w, -1, 1, 0, 1); \n"
  13. " f_texCoords = vec2(u, v); \n"
  14. "}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement