70 lines
1.6 KiB
HTML
70 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<script id="vertex-shader" type="x-shader/x-vertex">
|
|
#version 300 es
|
|
|
|
in vec2 aPosition;
|
|
in vec2 aTexCoord;
|
|
out vec2 vTexCoord;
|
|
|
|
void
|
|
main()
|
|
{
|
|
vTexCoord = aTexCoord;
|
|
gl_Position = vec4(aPosition, 0.0, 1.0);
|
|
}
|
|
</script>
|
|
|
|
<script id="fragment-shader" type="x-shader/x-fragment">
|
|
#version 300 es
|
|
|
|
precision mediump float;
|
|
|
|
in vec2 vTexCoord;
|
|
out vec4 fColor;
|
|
|
|
uniform sampler2D uTextureMap;
|
|
|
|
void
|
|
main()
|
|
{
|
|
float d = 1.0/256.0;
|
|
float x = vTexCoord.x;
|
|
float y = vTexCoord.y;
|
|
|
|
vec4 gx, gy;
|
|
|
|
|
|
gx = 3.0*texture(uTextureMap, vec2(x+d, y))
|
|
+ texture(uTextureMap, vec2(x+d, y+d))
|
|
+ texture(uTextureMap, vec2(x+d, y-d))
|
|
- 3.0*texture(uTextureMap, vec2(x-d, y))
|
|
- texture(uTextureMap, vec2(x-d, y+d))
|
|
- texture(uTextureMap, vec2(x-d, y-d));
|
|
|
|
gy = 3.0*texture(uTextureMap, vec2(x, y+d))
|
|
+ texture(uTextureMap, vec2(x+d, y+d))
|
|
+ texture(uTextureMap, vec2(x-d, y+d))
|
|
- 3.0*texture(uTextureMap, vec2(x, y-d))
|
|
- texture(uTextureMap, vec2(x+d, y-d))
|
|
- texture(uTextureMap, vec2(x-d, y-d));
|
|
|
|
fColor = sqrt(gx*gx + gy*gy);
|
|
|
|
fColor.w = 1.0;
|
|
}
|
|
</script>
|
|
|
|
<script type="text/javascript" src="../Common/initShaders.js"></script>
|
|
<script type="text/javascript" src="honolulu4.js"></script>
|
|
<script type="text/javascript" src="../Common/MVnew.js"></script>
|
|
<script type="text/javascript" src="hawaiisobel.js"></script>
|
|
|
|
<body>
|
|
<canvas id="gl-canvas" width="512" height="512">
|
|
Oops ... your browser doesn't support the HTML5 canvas element
|
|
</canvas>
|
|
</body>
|
|
</html>
|