Skip to content
This repository has been archived by the owner on Oct 23, 2018. It is now read-only.

Commit

Permalink
Add GLSL Fragment Shader example
Browse files Browse the repository at this point in the history
  • Loading branch information
Bluexin committed Oct 10, 2018
1 parent c3b8236 commit 45a4423
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions GLSL-Frag/hello.frag
@@ -0,0 +1,20 @@
#version 300 es
// See readme.md for info and example

precision mediump float;
out vec4 outColor;
void main() {
int x = int(gl_PointCoord.x * 19.0);
int y = int(gl_PointCoord.y * 5.0);
bool colored = false;
switch(x) {
case 0: case 2: case 4: case 8: case 12: case 16: case 18:
colored = true; break;
case 1: colored = y == 2; break;
case 5: case 6: colored = y % 2 == 0; break;
case 9: case 10: case 13: case 14:
colored = y == 4; break;
case 17: colored = y % 4 == 0; break;
}
outColor = colored? vec4(0.1, 0.3, 0.5, 1.0) : vec4(0.0, 0.0, 0.0, 0.0);
}
4 changes: 4 additions & 0 deletions GLSL-Frag/readme.md
@@ -0,0 +1,4 @@
# GLSL Fragment Shader

This is an example GLSL Fragment Shader to make `HELLO` pixel art.
Only tested using WebGL2, see on [fiddle](https://jsfiddle.net/zvcnm4rq/57/).

0 comments on commit 45a4423

Please sign in to comment.