Skip to content

Instantly share code, notes, and snippets.

@SabinT
Last active July 6, 2021 06:53
Show Gist options
  • Save SabinT/623d95550f79c21d19b76ef4ebfb18db to your computer and use it in GitHub Desktop.
Save SabinT/623d95550f79c21d19b76ef4ebfb18db to your computer and use it in GitHub Desktop.
GLSL texture wrapping/repeating
vec2 clamp(vec2 p) {
return clamp(p, 0, 1);
}
vec2 repeat(vec2 p) {
return fract(p);
}
vec2 mirrorRepeat(vec2 p) {
vec2 q = fract(p * 0.5) * 2.0;
return 1 - abs(q - 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment