adding glslviewer

This commit is contained in:
Patricio Gonzalez Vivo 2016-12-13 16:20:19 -05:00
parent b2124b6dd7
commit 9d94155128
7 changed files with 18 additions and 26 deletions

View File

@ -13,7 +13,7 @@ float rows = 100.0;
vec2 brickTile(vec2 _st, float _zoom){ vec2 brickTile(vec2 _st, float _zoom){
_st *= _zoom; _st *= _zoom;
if (fract(_st.y * 0.5) > 0.5){ if (fract(_st.y * 0.5) > 0.5) {
_st.x += 0.5; _st.x += 0.5;
} }
return fract(_st); return fract(_st);
@ -28,13 +28,20 @@ float circle(vec2 _st, float _radius){
void main(){ void main(){
vec2 st = gl_FragCoord.xy/u_resolution.xy; vec2 st = gl_FragCoord.xy/u_resolution.xy;
st = (st-.5)*1.02+.5;
st.x *= u_resolution.x/u_resolution.y; st.x *= u_resolution.x/u_resolution.y;
vec2 pos = st; vec2 pos = st;
float grid = 50.;
st = brickTile(st,500.); st *= grid;
if (fract(st.y * 0.5) > 0.5){
st.x += 0.5;
pos.x += 0.5/grid;
}
float pattern = texture2D(u_tex0,pos).r; float pattern = texture2D(u_tex0,clamp(floor(pos*grid)/grid+vec2(.5,.5)/grid,vec2(0.),vec2(1.))).r;
pattern = circle(st, pattern); pattern = circle(fract(st), smoothstep(0.1,1.,pattern));
gl_FragColor = vec4(1.-vec3(pattern),1.0); gl_FragColor = vec4(pattern,0.,0.,pattern);
} }

View File

@ -17,7 +17,7 @@ Auf einem **RaspberryPi** gibst Du folgendes ein:
```bash ```bash
sudo apt-get update sudo apt-get update
sudo apt-get upgrade sudo apt-get upgrade
sudo apt-get install git-core sudo apt-get install git-core glslviewer
``` ```
Hast Du alles beisammen, musst Du lediglich folgende Befehle aufrufen, um das *Book of Shaders* per GIT auf Deinen Rechner zu laden und den Server zur Anzeige des Inhalts zu starten: Hast Du alles beisammen, musst Du lediglich folgende Befehle aufrufen, um das *Book of Shaders* per GIT auf Deinen Rechner zu laden und den Server zur Anzeige des Inhalts zu starten:

View File

@ -17,7 +17,7 @@ Su **Raspberry Pi** è necessario fare:
```bash ```bash
sudo apt-get update sudo apt-get update
sudo apt-get upgrade sudo apt-get upgrade
sudo apt-get install git-core sudo apt-get install git-core glslviewer
``` ```
Una volta che avete installato tutto, non vi resta che fare: Una volta che avete installato tutto, non vi resta che fare:

View File

@ -17,7 +17,7 @@ On **Raspberry Pi** you need to do:
```bash ```bash
sudo apt-get update sudo apt-get update
sudo apt-get upgrade sudo apt-get upgrade
sudo apt-get install git-core sudo apt-get install git-core glslviewer
``` ```
Once you have everything installed you just need to do: Once you have everything installed you just need to do:

View File

@ -13,12 +13,7 @@ Um die angesprochenen Tools auf einem RaspberryPi zu installieren, rufe nach dem
```bash ```bash
sudo apt-get update sudo apt-get update
sudo apt-get upgrade sudo apt-get upgrade
sudo apt-get install git-core sudo apt-get install git-core glslviewer
cd ~
git clone http://github.com/patriciogonzalezvivo/glslViewer.git
cd glslViewer
make
make install
cd ~ cd ~
git clone https://github.com/patriciogonzalezvivo/thebookofshaders.git git clone https://github.com/patriciogonzalezvivo/thebookofshaders.git
cd thebookofshaders cd thebookofshaders

View File

@ -11,12 +11,7 @@ Per installare e configurare tutto ciò sul Raspberry Pi, dopo l'installazione d
```bash ```bash
sudo apt-get update sudo apt-get update
sudo apt-get upgrade sudo apt-get upgrade
sudo apt-get install git-core sudo apt-get install git-core glslviewer
cd ~
git clone http://github.com/patriciogonzalezvivo/glslViewer.git
cd glslViewer
make
make install
cd ~ cd ~
git clone https://github.com/patriciogonzalezvivo/thebookofshaders.git git clone https://github.com/patriciogonzalezvivo/thebookofshaders.git
cd thebookofshaders cd thebookofshaders

View File

@ -11,12 +11,7 @@ To install and set this all up on the Raspberry Pi after installing the OS and l
```bash ```bash
sudo apt-get update sudo apt-get update
sudo apt-get upgrade sudo apt-get upgrade
sudo apt-get install git-core sudo apt-get install git-core glslviewer
cd ~
git clone http://github.com/patriciogonzalezvivo/glslViewer.git
cd glslViewer
make
make install
cd ~ cd ~
git clone https://github.com/patriciogonzalezvivo/thebookofshaders.git git clone https://github.com/patriciogonzalezvivo/thebookofshaders.git
cd thebookofshaders cd thebookofshaders