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

glsl-numerify

v1.0.0

Published

glsl-numerify is a debugging shader generator for WebGL: given a texture, blows it up in size, displays the pixel values as numbers.

Downloads

2

Readme

glsl-numerify

####Description

glsl-numerify is a debugging shader generator for WebGL: given a texture, blows it up in size, displays the pixel values as numbers.

See glsl-numerify-demo.js for usage.

####Example results

Source texture, 4x4 (then scaled up):

Example source texture

Result, 256x256 (then scaled up):

Result texture

####How it works

Basically, it makes a cell for each input pixel.

  1. For each output pixel, it figures out which cell it lies within.
  2. For each output pixel, it figures out the offset within the cell it lies within.
  3. Using the in-cell offset, it determines how far off the right of the cell the current output pixel is.
  4. Using (3), it determines which digit place this output pixel lies within.
  5. Using the cell <=> source pixel relationship, it determines the value of the source pixel.
  6. Using (5), it determines what the digit value for that digit place is.
  7. Using (6,2), it picks a pixel from the digits texture, which stores all the digits (./assets/digits.bmp).

####Dependencies

  • nodejs
  • browserify
  • regl (for demo)
  • resl (for demo)
  • budo (for quick demo as an alternative to running browserify)

####Demo

To run the demo, run:

    cd ./glsl-numerify
    
    #install npm dependencies
    npm install
    
    #browser should open with the demo
    budo glsl-numerify-demo.js --open

    #note that if your resolution is small, it will render everything too small.
    #you can change the source texture size to see more satisfactory results.

Results:

branch | demo -------|------- master | glsl-numerify-demo develop | glsl-numerify-demo

####Usage

const numerify = require('./glsl-numerify.js');
numerify.makeFrag ({multiplier, sourceSize, destinationCellSize, destinationSize, component = 'r'})
  • returns the webgl 1.0 fragment shader to use.
  • multiplier
    1. the source texture is typically treated as a normalized floating point value between [0,1] in the shader.
    2. therefore, to get at the "real" value, you can supply a multiplier. So for example having a multiplier of 256 will result values in the range [0,255]. The output values will always be integer only, so this typically needs to be used.
  • sourceSize - a string in the form of a glsl vec2 with the source texture's size in pixels.
  • destinationCellSize - a string in the form of a glsl vec2 with the size of each cell within the destination texture.
  • destinationSize - the actual size of the destination texture; it might be exactly the same as sourceSize X destinationCellSize.
  • component - Which component of the input texture you are interested in rendering as digits.
numerify.makeVert ()
  • returns the webgl 1.0 vertex shader to use.