Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gl-texture2d

Package Overview
Dependencies
Maintainers
3
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gl-texture2d - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

11

package.json
{
"name": "gl-texture2d",
"version": "2.0.3",
"version": "2.0.4",
"description": "WebGL texture wrapper",

@@ -32,12 +32,13 @@ "main": "texture.js",

"gl-now": "^1.3.1",
"a-big-triangle": "0.0.0",
"baboon-image": "^1.0.0",
"glslify": "^1.4.0"
"glslify": "^1.4.0",
"a-big-triangle": "^1.0.0"
},
"dependencies": {
"webglew": "^1.0.0",
"webglew": "^1.0.4",
"ndarray": "^1.0.15",
"typedarray-pool": "^1.0.0",
"ndarray-ops": "^1.1.0"
"ndarray-ops": "^1.2.2",
"baboon-image": "^1.0.0"
}
}

@@ -44,3 +44,3 @@ 'use strict'

if(w < 0 || w > maxSize || h < 0 || h > maxSize) {
throw new Error("gl-texture2d: Invalid texture size")
throw new Error('gl-texture2d: Invalid texture size')
}

@@ -69,4 +69,4 @@ tex._shape = [w, h]

var wrapVector = [this._wrapS, this._wrapT]
Object.defineProperties(wrapVector, {
"0": {
Object.defineProperties(wrapVector, [
{
get: function() {

@@ -79,3 +79,3 @@ return parent._wrapS

},
"1": {
{
get: function() {

@@ -88,8 +88,8 @@ return parent._wrapT

}
})
])
this._wrapVector = wrapVector
var shapeVector = [this._shape[0], this._shape[1]]
Object.defineProperties(shapeVector, {
"0": {
Object.defineProperties(shapeVector, [
{
get: function() {

@@ -102,3 +102,3 @@ return parent._shape[0]

},
"1" : {
{
get: function() {

@@ -111,3 +111,3 @@ return parent._shape[1]

}
})
])
this._shapeVector = shapeVector

@@ -119,3 +119,3 @@ }

Object.defineProperties(proto, {
"minFilter": {
minFilter: {
get: function() {

@@ -133,3 +133,3 @@ return this._minFilter

if(filterTypes.indexOf(v) < 0) {
throw new Error("gl-texture2d: Unknown filter mode " + v)
throw new Error('gl-texture2d: Unknown filter mode ' + v)
}

@@ -140,3 +140,3 @@ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, v)

},
"magFilter": {
magFilter: {
get: function() {

@@ -154,3 +154,3 @@ return this._magFilter

if(filterTypes.indexOf(v) < 0) {
throw new Error("gl-texture2d: Unknown filter mode " + v)
throw new Error('gl-texture2d: Unknown filter mode ' + v)
}

@@ -161,3 +161,3 @@ gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, v)

},
"mipSamples": {
mipSamples: {
get: function() {

@@ -178,3 +178,3 @@ return this._anisoSamples

},
"wrapS": {
wrapS: {
get: function() {

@@ -186,3 +186,3 @@ return this._wrapS

if(wrapTypes.indexOf(v) < 0) {
throw new Error("gl-texture2d: Unknown wrap mode " + v)
throw new Error('gl-texture2d: Unknown wrap mode ' + v)
}

@@ -193,3 +193,3 @@ this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, v)

},
"wrapT": {
wrapT: {
get: function() {

@@ -201,3 +201,3 @@ return this._wrapT

if(wrapTypes.indexOf(v) < 0) {
throw new Error("gl-texture2d: Unknown wrap mode " + v)
throw new Error('gl-texture2d: Unknown wrap mode ' + v)
}

@@ -208,3 +208,3 @@ this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, v)

},
"wrap": {
wrap: {
get: function() {

@@ -218,7 +218,7 @@ return this._wrapVector

if(v.length !== 2) {
throw new Error("gl-texture2d: Must specify wrap mode for rows and columns")
throw new Error('gl-texture2d: Must specify wrap mode for rows and columns')
}
for(var i=0; i<2; ++i) {
if(wrapTypes.indexOf(v[i]) < 0) {
throw new Error("gl-texture2d: Unknown wrap mode " + v)
throw new Error('gl-texture2d: Unknown wrap mode ' + v)
}

@@ -237,3 +237,3 @@ }

},
"shape": {
shape: {
get: function() {

@@ -247,3 +247,3 @@ return this._shapeVector

if(x.length !== 2) {
throw new Error("gl-texture2d: Invalid texture shape")
throw new Error('gl-texture2d: Invalid texture shape')
}

@@ -255,3 +255,3 @@ }

},
"width": {
width: {
get: function() {

@@ -266,3 +266,3 @@ return this._shape[0]

},
"height": {
height: {
get: function() {

@@ -286,3 +286,3 @@ return this._shape[1]

if(unit !== undefined) {
return unit
return (unit|0)
}

@@ -338,7 +338,7 @@ return gl.getParameter(gl.ACTIVE_TEXTURE) - gl.TEXTURE0

y_off < 0) {
throw new Error("gl-texture2d: Texture dimensions are out of bounds")
throw new Error('gl-texture2d: Texture dimensions are out of bounds')
}
texSubImageArray(gl, x_off, y_off, mip_level, this.format, this.type, this._mipLevels, data)
} else {
throw new Error("gl-texture2d: Unsupported data type")
throw new Error('gl-texture2d: Unsupported data type')
}

@@ -362,13 +362,13 @@ }

if(shape.length < 2 || shape.length > 3) {
throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d")
throw new Error('gl-texture2d: Invalid ndarray, must be 2d or 3d')
}
var type = 0, format = 0
var packed = isPacked(shape, array.stride.slice())
if(dtype === "float32") {
if(dtype === 'float32') {
type = gl.FLOAT
} else if(dtype === "float64") {
} else if(dtype === 'float64') {
type = gl.FLOAT
packed = false
dtype = "float32"
} else if(dtype === "uint8") {
dtype = 'float32'
} else if(dtype === 'uint8') {
type = gl.UNSIGNED_BYTE

@@ -378,3 +378,3 @@ } else {

packed = false
dtype = "uint8"
dtype = 'uint8'
}

@@ -396,7 +396,7 @@ var channels = 1

} else {
throw new Error("gl-texture2d: Invalid shape for pixel coords")
throw new Error('gl-texture2d: Invalid shape for pixel coords')
}
channels = shape[2]
} else {
throw new Error("gl-texture2d: Invalid shape for texture")
throw new Error('gl-texture2d: Invalid shape for texture')
}

@@ -409,3 +409,3 @@ //For 1-channel textures allow conversion between formats

if(format !== cformat) {
throw new Error("gl-texture2d: Incompatible texture format for setPixels")
throw new Error('gl-texture2d: Incompatible texture format for setPixels')
}

@@ -472,3 +472,3 @@ var size = array.size

if(width < 0 || width > maxTextureSize || height < 0 || height > maxTextureSize) {
throw new Error("gl-texture2d: Invalid texture shape")
throw new Error('gl-texture2d: Invalid texture shape')
}

@@ -492,13 +492,13 @@ var tex = initTexture(gl)

if(shape[0] < 0 || shape[0] > maxSize || shape[1] < 0 || shape[1] > maxSize) {
throw new Error("gl-texture2d: Invalid texture size")
throw new Error('gl-texture2d: Invalid texture size')
}
var packed = isPacked(shape, array.stride.slice())
var type = 0
if(dtype === "float32") {
if(dtype === 'float32') {
type = gl.FLOAT
} else if(dtype === "float64") {
} else if(dtype === 'float64') {
type = gl.FLOAT
packed = false
dtype = "float32"
} else if(dtype === "uint8") {
dtype = 'float32'
} else if(dtype === 'uint8') {
type = gl.UNSIGNED_BYTE

@@ -508,3 +508,3 @@ } else {

packed = false
dtype = "uint8"
dtype = 'uint8'
}

@@ -526,6 +526,6 @@ var format = 0

} else {
throw new Error("Invalid shape for pixel coords")
throw new Error('gl-texture2d: Invalid shape for pixel coords')
}
} else {
throw new Error("Invalid shape for texture")
throw new Error('gl-texture2d: Invalid shape for texture')
}

@@ -542,3 +542,3 @@ if(type === gl.FLOAT && !webglew(gl).texture_float) {

var buf_array = ndarray(buf_store, shape, stride, 0)
if((dtype === "float32" || dtype === "float64") && type === gl.UNSIGNED_BYTE) {
if((dtype === 'float32' || dtype === 'float64') && type === gl.UNSIGNED_BYTE) {
convertFloatToUint8(buf_array, array)

@@ -564,3 +564,3 @@ } else {

if(arguments.length <= 1) {
throw new Error("Missing arguments for texture2d constructor")
throw new Error('gl-texture2d: Missing arguments for texture2d constructor')
}

@@ -570,3 +570,3 @@ if(!linearTypes) {

}
if(typeof arguments[1] === "number") {
if(typeof arguments[1] === 'number') {
return createTextureShape(gl, arguments[1], arguments[2], arguments[3]||gl.RGBA, arguments[4]||gl.UNSIGNED_BYTE)

@@ -577,3 +577,3 @@ }

}
if(typeof arguments[1] === "object") {
if(typeof arguments[1] === 'object') {
var obj = arguments[1]

@@ -589,3 +589,3 @@ if(obj instanceof HTMLCanvasElement ||

}
throw new Error("Invalid arguments for texture2d constructor")
throw new Error('gl-texture2d: Invalid arguments for texture2d constructor')
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc