This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() | |
{ | |
size(240,240); | |
} | |
void draw() | |
{ | |
background(0); | |
for(int blur=0;blur<10;blur++) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uniform ivec2 size; | |
uniform float m; | |
uniform sampler2D texture; | |
uniform sampler2D tex; | |
void main() | |
{ | |
ivec2 p=ivec2(gl_FragCoord.xy); | |
gl_FragColor=texelFetch(texture,p,0)+texelFetch(tex,p,0)*m; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PShader shader; | |
void setup() | |
{ | |
size(480,480,P2D); | |
shader=loadShader("shader.glsl"); | |
} | |
void draw() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// you must prepare image | |
PImage image; | |
int[] x=new int[4]; | |
int[] y=new int[4]; | |
void setup() | |
{ | |
size(displayWidth,displayHeight,P2D); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function k2n(key) | |
{ | |
switch(key) | |
{ | |
case 90:return 48; // C4 | |
case 83:return 49; // C#4 | |
case 88:return 50; // D4 | |
case 68:return 51; // D#4 | |
case 67:return 52; // E4 | |
case 86:return 53; // F4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void star(int x,int y) | |
{ | |
pushMatrix(); | |
translate(x,y); | |
beginShape(); | |
for(int i=0;i<10;i++) | |
{ | |
float th=i*0.1*PI*2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
precision mediump float; | |
uniform float t; // time | |
uniform vec2 r; // resolution | |
vec2 v=vec2(0.,1.); | |
float f(vec3 p) | |
{ | |
return length(p)-.6; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PI 3.1415926 | |
void main(void) | |
{ | |
vec2 uv=vec2(gl_FragCoord.xy-iResolution.xy/2.0); | |
vec2 mouse=vec2(iMouse.xy-iResolution.xy/2.0); | |
if(length(uv)<100.0) | |
{ | |
vec3 nor=vec3(0.0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gl_FragColor : ここに色()[vec4]を代入する | |
// gl_FragCoord.x : 実行中のピクセルのx座標 [float] | |
// gl_FragCoord.y : 実行中のピクセルのy座標 [float] | |
// gl_FragCoord.xy : 実行中のピクセルのxy座標 [vec2] | |
// おまじない(しっかり説明すると、GLESで浮動小数点の精度を低めないと動かない端末が多い) | |
#ifdef GL_ES | |
precision mediump float; | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform vec2 resolution; | |
float distFunc( vec3 p ) | |
{ | |
return length( p ) - 0.3; // 半径0.3の球体 | |
} |
OlderNewer