Comparing version 1.0.4 to 1.0.5
{ | ||
"name": "gl-util", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "Set of practical webgl utils", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -32,3 +32,3 @@ 'use strict' | ||
let textures = texturesCache.has(program) ? texturesCache.get(program) : texturesCache.set(program, {}).get(program); | ||
let textures = texturesCache.has(gl) ? texturesCache.get(gl) : texturesCache.set(gl, {}).get(gl); | ||
@@ -58,5 +58,8 @@ //return all textures if no name provided | ||
//detect location | ||
if (texture.location == null) { | ||
texture.location = gl.getUniformLocation(program, name); | ||
if (texture.locations == null) { | ||
texture.locations = new WeakMap(); | ||
} | ||
if (!texture.locations.has(program)) { | ||
texture.locations.set(program, gl.getUniformLocation(program, name)) | ||
} | ||
@@ -74,3 +77,3 @@ //if no options passed - just return known texture info | ||
texturesIdx.set(program, textureCount); | ||
texture.location && gl.uniform1i(texture.location, texture.index); | ||
gl.uniform1i(texture.locations.get(program), texture.index); | ||
} | ||
@@ -77,0 +80,0 @@ |
81721
553