Skip to content

Instantly share code, notes, and snippets.

@1chandu
1chandu / index.html
Last active October 3, 2019 02:12
Rendering to 1X1 Target (WebGL1 with point sizes setting)
<!DOCTYPE html>
<html>
<script type="vertex" id="vs">
attribute float vertexID;
varying vec4 vColor;
void main(void) {
gl_PointSize = 1.0;
gl_Position = vec4(0., 0., 0., 1.); // Failed on windows chrome/firefox, passed on firefox with disable-angle
// gl_Position = vec4(-1., -1., 0., 1.); // Failed on widnows chrome/firefox, passed on firefox with disable-angle
// gl_Position = vec4(0.5, 0.5, 0., 1.); // Failed on widnows chrome/firefox, passed on firefox with disable-angle
@1chandu
1chandu / index.html
Last active September 27, 2019 20:59
Rendering to 2X2 (WebGL1)
<!DOCTYPE html>
<html>
<script type="vertex" id="vs">
attribute float vertexID;
varying vec4 vColor;
void main(void) {
gl_Position = vec4(-0.5, -0.5, 0., 1.);
// gl_Position = vec4(-1., -1., 0., 1.);
// gl_Position = vec4(1.0, 1.0, 0., 1.);
vColor = vec4(1, 1, 1, vertexID/255.0);
@1chandu
1chandu / index.html
Last active September 27, 2019 04:55
Rendering to 1X1 Target (WebGL1)
<!DOCTYPE html>
<html>
<script type="vertex" id="vs">
attribute float vertexID;
varying vec4 vColor;
void main(void) {
gl_Position = vec4(0., 0., 0., 1.); // Failed on windows chrome/firefox, passed on firefox with disable-angle
// gl_Position = vec4(-1., -1., 0., 1.); // Failed on widnows chrome/firefox, passed on firefox with disable-angle
// gl_Position = vec4(0.5, 0.5, 0., 1.); // Failed on widnows chrome/firefox, passed on firefox with disable-angle
vColor = vec4(1, 1, 1, vertexID);
@1chandu
1chandu / index.html
Last active September 27, 2019 00:42
Render to 1X1 Target (WebGL2, RGBA32F)
<!DOCTYPE html>
<html>
<script type="vertex" id="vs">
attribute float vertexID;
varying vec4 vColor;
void main(void) {
gl_Position = vec4(0., 0., 0., 1.); // Failed on windows chrome/firefox, passed on firefox with disable-angle
// gl_Position = vec4(-1., -1., 0., 1.); // Failed on widnows chrome/firefox, passed on firefox with disable-angle
// gl_Position = vec4(0.5, 0.5, 0., 1.); // Failed on widnows chrome/firefox, passed on firefox with disable-angle
vColor = vec4(2., 22., 222., vertexID);
@1chandu
1chandu / index.html
Created September 26, 2019 21:50
Additive Blending 1X1 (WebGL)
<!DOCTYPE html>
<html>
<script type="vertex" id="vs">
attribute float vertexID;
varying vec4 vColor;
void main(void) {
gl_Position = vec4(0., 0., 0., 1.);
// gl_Position = vec4(-1., -1., 0., 1.);
// gl_Position = vec4(1., 1., 0., 1.);
vColor = vec4(vertexID, 0., 0., 1.);
@1chandu
1chandu / index.html
Last active September 26, 2019 22:12
Additive Blending (1X1 target)
<!DOCTYPE html>
<html>
<script type="vertex" id="vs">
attribute float vertexID;
varying vec4 vColor;
void main(void) {
gl_Position = vec4(0., 0., 0., 1.); // Failed on windows chrome/firefox, passed on firefox with disable-angle
// gl_Position = vec4(-1., -1., 0., 1.); // Failed on widnows chrome/firefox, passed on firefox with disable-angle
// gl_Position = vec4(0.5, 0.5, 0., 1.); // Failed on widnows chrome/firefox, passed on firefox with disable-angle
vColor = vec4(vertexID, 0., 0., 1.);
@1chandu
1chandu / index.html
Last active September 26, 2019 22:09
Additive Blending (NXN target)
<!DOCTYPE html>
<html>
<script type="vertex" id="vs">
attribute vec2 positions;
void main(void) {
gl_Position = vec4(positions, 0., 1.);
}
</script>
<script type="fragment" id="fs">
precision highp float;
@1chandu
1chandu / headless.js
Last active October 16, 2023 11:51
Min max blending with float render target
/* Node.js v10+ */
const puppeteer = require('puppeteer');
const URL = 'https://bl.ocks.org/1chandu/37743a37df149d0439cd91246884f92d';
puppeteer.launch({headless: true})
.then(async function(browser) {
const page = await browser.newPage();
page.on('console', event => {