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
| <style>canvas{background-color:blue};</style> | |
| <canvas width="256" height="256"></canvas><hr/> | |
| <script>"use strict"; | |
| let cv0=document.createElement("canvas"); cv0.width=32;cv0.height=32; | |
| let cc=cv0.getContext("2d"); cc.font="24px serif"; | |
| let cx=document.querySelector("canvas").getContext("webgl"); | |
| const vsrc=`attribute vec4 p;varying vec3 eye; | |
| void main(){gl_Position=p;gl_Position.xy=2.*p.xy-1.;eye=vec3(2.*p.xy-1.,.8);}`; | |
| const fsrc=`precision highp float; | |
| uniform samplerCube tx6;uniform mat3 m3;varying vec3 eye; |
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
| <canvas width="256" height="256"></canvas><hr/> | |
| <script>"use strict"; | |
| let data=new Uint8Array(64*64*4); | |
| for(let i=0; i<data.length; i++)data[i]=0xff*Math.random(); | |
| const vsrc=`attribute vec4 p;void main(){gl_PointSize=256.;gl_Position=p;}`; | |
| const fsrc=`precision highp float;uniform samplerCube tx6;uniform float th; | |
| void main(){ | |
| vec3 eye=vec3(2.*gl_PointCoord.xy-1.,1); eye.xy+=vec2(cos(th),sin(th)); | |
| gl_FragColor=textureCube(tx6,normalize(eye)); | |
| }`; |
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
| <style>canvas,textarea,video{background-color: bisque;}</style> | |
| <canvas width="512" height="512"></canvas><hr/> | |
| <textarea id="LOG" cols="30" rows="10"></textarea> | |
| <video id="VD0" src="" loop autoplay muted hidden></video> | |
| <video id="VD1" src="" loop autoplay muted hidden></video> | |
| <script>"use strict"; | |
| let vsrc=`attribute vec4 p;void main(){gl_PointSize=512.;gl_Position=p;}`; | |
| let fsrc=`precision highp float;uniform sampler2D tx; | |
| void main(){gl_FragColor=vec4(texture2D(tx,gl_PointCoord).rgb,1);}`; | |
| let cx=document.querySelector("canvas").getContext("webgl"); |
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
| <style>canvas,textarea{background-color:bisque;}</style> | |
| <canvas width="256" height="256"></canvas> | |
| <textarea id="LOG" cols="30" rows="10"></textarea> | |
| <script>"use strict"; | |
| let vsrc0=`attribute vec4 p;void main(){gl_PointSize=250.;gl_Position=p;}`; | |
| let fsrc0=`uniform sampler2D tx;void main(){gl_FragColor=texture2D(tx,gl_PointCoord*3.);}`; | |
| let vsrc1=`attribute vec4 p;void main(){gl_PointSize=128.;gl_Position=p;}`; | |
| let fsrc1=`void main(){gl_FragColor=(length(gl_PointCoord-.5)<.3)?vec4(1,0,0,1):vec4(1);}`; | |
| let cx=document.querySelector("canvas").getContext("webgl"); | |
| let fb=getFb(256,256); |
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
| <style>canvas,textarea{background-color: bisque;}</style> | |
| <canvas width="128" height="128"></canvas><hr/> | |
| <textarea id="LOG" cols="48" rows="16" hidden></textarea> | |
| <script>"use strict"; | |
| let vsrc=`attribute vec4 p;void main(){gl_PointSize=64.;gl_Position=p;}`; | |
| let fsrc=`void main(){ | |
| if(length(gl_PointCoord.xy-vec2(.5))>.5)discard; | |
| gl_FragColor=vec4(gl_PointCoord.xy,0,1);}`; | |
| let cx=document.querySelector("canvas").getContext("webgl"); | |
| try{ cx.useProgram(getPg(vsrc,fsrc));requestAnimationFrame(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
| <style>canvas,textarea{background-color: bisque;}</style> | |
| <canvas width="256" height="256"></canvas><hr/> | |
| <textarea name="" id="LOG" cols="40" rows="12"></textarea> | |
| <script>"use strict"; | |
| let vsrc=`attribute vec4 p; | |
| uniform mat3 m3; | |
| varying vec3 vPos,vDep; | |
| void main(){ | |
| vPos=p.xyz; | |
| vec4 p2=vec4(p.xyz*m3,1); |
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
| <canvas></canvas> | |
| <script> | |
| const hello=` | |
| #...#.#####.#####.#####..###.. | |
| #...#.#.....#.....#.....#...#. | |
| #####.####..#.....#.....#...#. | |
| #...#.#.....#.....#.....#...#. | |
| #...#.#####.#.....#......###..`; | |
| let cx=document.querySelector("canvas").getContext("webgl"); | |
| cx.clearColor(0,0.3,0,1); cx.clear(0x4000); |
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
| <style>canvas{background-color: cornflowerblue;}</style> | |
| <canvas width="512" height="512"></canvas> | |
| <script> | |
| const opt={}; | |
| let cx=document.querySelector("canvas").getContext("webgl",opt); | |
| let pg=cx.createProgram(); | |
| let vs=cx.createShader(cx.VERTEX_SHADER); cx.attachShader(pg,vs); | |
| let fs=cx.createShader(cx.FRAGMENT_SHADER); cx.attachShader(pg,fs); | |
| let vsrc=`attribute vec4 p;uniform mat4 m4; | |
| varying float c; |
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
| <style>canvas{background-color: black;}</style> | |
| <canvas width="512" height="512"></canvas> | |
| <script>"use strict"; | |
| const vsrc=`attribute vec4 p; | |
| uniform mat4 umat; uniform sampler2D tex0; | |
| varying vec4 vp; | |
| void main(){ | |
| gl_PointSize=3.; | |
| vp=p, vp.z=texture2D(tex0,p.xy*0.5+0.5).z; | |
| gl_Position=umat*vp*0.7;gl_Position.w=1.; |
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
| <style>textarea{background-color: bisque;}</style> | |
| <canvas width="256" height="256"></canvas><hr/> | |
| <textarea id="VS" cols="36" rows="8"></textarea> | |
| <textarea id="FS" cols="36" rows="8"></textarea> | |
| <textarea id="LG" cols="36" rows="8"></textarea> | |
| <script> | |
| VS.value=`attribute vec4 p;\nvoid main(){ | |
| gl_PointSize=200.;\n gl_Position=p;\n}`; | |
| FS.value=`precision highp float;\nuniform vec4 u;\nvoid main(){ | |
| gl_FragColor=vec4(1);\n gl_FragColor.rg=gl_PointCoord.xy; |