pathgl
Version:
A webgl renderer for data visualization, motion graphics and explorable explanations.
73 lines (67 loc) • 3.06 kB
HTML
<head>
<meta charset="utf-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>WebGL Library for Data Visualization and Simulation - PathGL</title>
<script src="/lib/d3.js"></script>
<script src="/lib/topojson.v1.min.js"></script>
<script src="/lib/projection.js"></script>
<script src="/lib/tip.js"></script>
<script src="/dist/pathgl.js"></script>
<link rel="stylesheet" href="/lib/adnan.css">
</head>
<body>
<div class="nav">
<a href="http://github.com/adnan-wahab/pathgl">Github Repo</a>
<a href="/dist/pathgl.zip">Download</a>
<h3>Examples</h3>
<ul class="examples">
<li class="mobile-only"><a href="/examples/swarm.html">200k Circles</a>
<li class="desktop-only"><a href="/examples/physics.html">Particle Simulation</a>
<li><a href="/examples/map.html">Map of History</a>
<li><a href="/examples/music.html">Music Visualizer</a>
</ul>
<h3>Documentation</h3>
<ul class="docs">
<li><a href="/documentation/start.html">Getting Started</a>
<li><a href="/documentation/api.html">API Reference</a>
<li><a href="/documentation/webgl.html">The Graphics Pipeline</a>
<li><a href="/documentation/svg.html">SVG Differences</a>
<li><a href="/documentation/gpgpu.html">GPGPU</a>
</ul>
<div class="mode">
<h3>Rendering Mode</h3>
<label for="svg">SVG<input type="radio" name="mode" id="svg"></label>
<label for="webgl">WebGL<input type="radio" name="mode" checked="1" id="webgl"></label>
<img class="t" src="data/test.png">
<img class="l" src="data/leaves.jpg">
</div>
</div>
<div class="right" id="scroll">
<div class="blurb"></div>
<svg></svg>
<canvas width="960" height="500"></canvas>
<p>GPGPU is a technique for offloading heavy computation to the graphics card.</p>
<p>GPGPU programs are written as fragment shaders in GLSL, a statically typed
javascript-like language with specialized support for vector manipulation.</p>
<p>In webGL, a pixel is a vector with 4 floats. Typically these
elements represent RGBA color channels, but we can use them for anything.
For example, by thinking of each pixel as a vector containing
<code>(positionX, positionY, velocityX, velocityY)</code>, we can simulate a particle by
integrating velocity into position on every frame.</p>
<p>Drawing a square with dimensions 1000x1000 spawns 1 million
threads. The output of these threads can be written to a texture,
which is then sampled as input on the next cycle, allowing state to be
passed between frames.</p>
<p>A task may benefit from gpgpu if it </p>
<ol>
<li>has a high computation to IO ratio</li>
<li>decomposes cleanly to map, reduce, filter, scatter, gather, sort, and search operations</li>
<li>has minimal dependency between data elements</li>
<li>is expressed mostly through vector arithmetic</li>
</ol>
<p>Examples include fft, image processing, simulating physical models like weather and
cosmology, neural networks, cryptography, and so on. </p>
</div>
</body>