@@ -70,13 +70,9 @@ implemented in JavaScript they'd look something like:
7070``` js
7171// PSEUDO CODE!!!
7272gl .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-
8076gl .activeTexture = function (unit ) {
8177 gl .activeTextureUnit = unit - gl .TEXTURE0 ; // convert to 0 based index
8278};
@@ -96,14 +92,13 @@ be implemented something like
9692gl .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
10398gl .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