gl-to-dtype
turns a gl type into a dtype string
Last updated 12 years ago by mattdesl .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install gl-to-dtype 
SYNC missed versions from official npm registry.

gl-to-dtype

stable

Turns a WebGL constant into a dtype string.

var asDtype = require('gl-to-dtype')
var dtype = require('dtype')

var glType = gl.FLOAT
var type = asDtype(glType)
var array = new (dtype(type))(16)

Converts the following:

gl.FLOAT          -> 'float32'
gl.UNSIGNED_INT   -> 'uint32'
gl.INT            -> 'int32'
gl.UNSIGNED_SHORT -> 'uint16'
gl.SHORT          -> 'int16'
gl.UNSIGNED_BYTE  -> 'uint8'
gl.BYTE           -> 'int8'
gl.UNSIGNED_SHORT_4_4_4_4 -> 'uint16'
gl.UNSIGNED_SHORT_5_5_5_1 -> 'uint16'
gl.UNSIGNED_SHORT_5_6_5 -> 'uint16'

Usage

NPM

require('gl-to-dtype')(glType)

Takes glType constant and returns a string representation aligning with ndarray, dtype and other modules.

Returns null if the flag isn't recognized as a supported type.

License

MIT, see LICENSE.md for details.

Current Tags

  • 1.1.0                                ...           latest (12 years ago)

2 Versions

  • 1.1.0                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 6
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 1
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE