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

gl-texture2d

Package Overview
Dependencies
Maintainers
1
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 0.1.5 to 0.1.6

2

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

@@ -5,0 +5,0 @@ "main": "texture.js",

@@ -9,2 +9,28 @@ "use strict"

var linearTypes = null
var filterTypes = null
var wrapTypes = null
function lazyInitLinearTypes(gl) {
linearTypes = [
gl.LINEAR,
gl.NEAREST_MIPMAP_LINEAR,
gl.LINEAR_MIPMAP_NEAREST,
gl.LINEAR_MIPMAP_NEAREST
]
filterTypes = [
gl.NEAREST,
gl.LINEAR,
gl.NEAREST_MIPMAP_NEAREST,
gl.NEAREST_MIPMAP_LINEAR,
gl.LINEAR_MIPMAP_NEAREST,
gl.LINEAR_MIPMAP_LINEAR
]
wrapTypes = [
gl.REPEAT,
gl.CLAMP_TO_EDGE,
gl.MIRRORED_REPEAT
]
}
var convertFloatToUint8 = makeOp({

@@ -37,3 +63,12 @@ args:["array", "array"],

this.bind()
this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, v)
var gl = this.gl
if(this.type === gl.FLOAT && linearTypes.indexOf(v) >= 0) {
if(!webglew(gl).OES_texture_float_linear) {
v = gl.NEAREST
}
}
if(filterTypes.indexOf(v) < 0) {
throw new Error("gl-texture2d: Unknown filter mode " + v)
}
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, v)
return this._minFilter = v

@@ -51,3 +86,12 @@ }

this.bind()
this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, v)
var gl = this.gl
if(this.type === gl.FLOAT && linearTypes.indexOf(v) >= 0) {
if(!webglew(gl).OES_texture_float_linear) {
v = gl.NEAREST
}
}
if(filterTypes.indexOf(v) < 0) {
throw new Error("gl-texture2d: Unknown filter mode " + v)
}
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, v)
return this._magFilter = v

@@ -63,2 +107,5 @@ }

this.bind()
if(wrapTypes.indexOf(v) < 0) {
throw new Error("gl-texture2d: Unknown wrap mode " + v)
}
this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, v)

@@ -75,2 +122,5 @@ return this._wrapS = v

this.bind()
if(wrapTypes.indexOf(v) < 0) {
throw new Error("gl-texture2d: Unknown wrap mode " + v)
}
this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, v)

@@ -363,2 +413,5 @@ return this._wrapT = v

}
if(!linearTypes) {
linearTypes = lazyInitLinearTypes(gl)
}
if(typeof arguments[1] === "object") {

@@ -365,0 +418,0 @@ var obj = arguments[1]

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