npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

webgp

v0.1.1

Published

Web GPU Programming - if some things can be made simple, complex things can be possible

Downloads

8

Readme

WebGP.js

"If some things can be made simple, complex things can be possible"

License MIT ES6 WebGL2 OpenGL ES 3.0

a JavaScript library for GPU computation and visualization using WebGL2

See Home Page for description and features

Demo gallery

Instructions

<script src="https://rawgit.com/glennirwin/webgp/master/src/webgp.js"></script>
  • or download and locally include it or copy/clone the source on Github.
    Only the one file is needed and there are no dependencies other than WebGL2 support in the browser

  • Read the sample code below and try it out locally

  • Check out the other code examples

  • Read the API documentation

Example Code

<!DOCTYPE html>
<html><head><title>WebGP - Rainbow Fountain</title><meta charset="utf-8"></head>
<body style="margin: 0; background-color: black;">
<script src="https://rawgit.com/glennirwin/webgp/master/src/webgp.js"></script>
<script>

const GP = WebGP();                         // Can Optionally pass a canvas and/or a gl context

let log = GP.Util.initializeHeadsUpLog();  // Comment these to hide the log and controls
GP.Util.createShaderControls("GP");

const vc = new GP.VertexComputer({				// Create a GPU computer
    units: 1e6, // number of elements
    struct: {								  						// define the unit data
        position: "vec2",
        velocity: "vec2",    // define attributes using GLSL types
            mass: "int",
           color: "vec3"
    },
    initializeObject: (i) => { return {           // initialize each object data with a return object
        position: [Math.random(),Math.random()],
        velocity: [(Math.random() - .25) / 20,(Math.random() - .25) / 20],  // a vec2 is an array of 2 numbers
        mass: 1 + Math.random() * 4,
        color: [Math.random(),Math.random(),Math.random()] };  // Note: Use the index i to map your data
    },
    updateStep: {     // update each unit (Transform feedback is used)
        glsl: `
            void main() {
                o_position = i_position + i_velocity;
                o_velocity = i_velocity - 0.001 * i_position / float(i_mass);
                o_mass = i_mass;
                o_color = i_color;
            }  `										// Note; make sure to assign all the outputs
    },
    renderStep: {			// render each unit by setting the gl_Position and the vertexColor
        glsl: `
            void main() {      // This is a vertex shader to position the points on the display
                gl_Position = vec4(i_position, 0.0, 1.0);
                vertexColor = vec4(i_color, .5);
                gl_PointSize = float(i_mass)/2.0;
            }   `     // default fragment shader will be used to show the points
    }
});

vc.run();  // the simplest way to run it forever, use step() to run in your own loop

</script>
</body></html>

Run this example in your browser

License

WebGP is released under the MIT license. Glenn Irwin, 2018.

WebGP.js started as a fork of: WebGPGPU released under the MIT license. Pierre Boyer, 2017.