Skip to content

Commit 377cc26

Browse files
committed
remove Texture
1 parent 9217b49 commit 377cc26

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

webgl/lessons/webgl-texture-units.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,9 @@ implemented in JavaScript they'd look something like:
7070
```js
7171
// PSEUDO CODE!!!
7272
gl.createTexture = function() {
73-
return new Texture();
73+
return new WebGLTexture();
7474
};
7575

76-
class Texture() {
77-
mips = [new Array(6)]; // faces of mip levels
78-
}
79-
8076
gl.activeTexture = function(unit) {
8177
gl.activeTextureUnit = unit - gl.TEXTURE0; // convert to 0 based index
8278
};
@@ -96,14 +92,13 @@ be implemented something like
9692
gl.texImage2D = function(target, level, internalFormat, width, height, border, format, type, data) {
9793
const textureUnit = gl.textureUnits[gl.activeTextureUnit];
9894
const texture = textureUnit[target];
99-
const face = targetToFace(target) // 0-5, 0 for 2D texture, 0-5 for cube maps
100-
texture.mips[face][level] = convertDataToInternalFormat(internalFormat, width, height, format, type, data);
95+
texture.setMipLevel(target, level, convertDataToInternalFormat(internalFormat, width, height, format, type, data));
10196
}
10297

10398
gl.texParameteri = function(target, pname, value) {
10499
const textureUnit = gl.textureUnits[gl.activeTextureUnit];
105100
const texture = textureUnit[target];
106-
texture[pname] = value;
101+
texture.setSetting(pname, value);
107102
}
108103
```
109104

0 commit comments

Comments
 (0)