https://github.com/riccardoscalco/glsl-tiling
Utility function for the tessellation of the [0, 1] plane.
https://github.com/riccardoscalco/glsl-tiling
glsl glslify tessellation tiles tiling webgl
Last synced: about 1 year ago
JSON representation
Utility function for the tessellation of the [0, 1] plane.
- Host: GitHub
- URL: https://github.com/riccardoscalco/glsl-tiling
- Owner: riccardoscalco
- License: mit
- Created: 2019-05-30T21:13:31.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-03T02:43:19.000Z (over 3 years ago)
- Last Synced: 2025-04-14T09:12:08.347Z (about 1 year ago)
- Topics: glsl, glslify, tessellation, tiles, tiling, webgl
- Language: GLSL
- Size: 529 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 14
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# glsl-tiling
Utility function for the tessellation of the [0, 1] plane.
## Install
```sh
npm install glsl-tiling
```
## Usage
```glsl
#pragma glslify: tiling = require(glsl-tiling);
void main() {
vec2 p = gl_FragCoord.xy / resolution.xy;
// t.xy is a vec2 with the new coordinates.
// t.zw is a vec2 with the tiles i, j indexes, from 0 to the number of columns(rows) - 1.
vec4 t = tiling(p, vec2(3., 2.)); // 3 columns and 2 rows
gl_FragColor = vec4(t.xy, vec2(1.0));
}
```