gl-to-dtype
turns a gl type into a dtype string
Last updated 6 years ago by mattdesl .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm 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 (6 years ago)

2 Versions

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

Copyright 2014 - 2017 © taobao.org |