@@ -133,17 +133,18 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
133133 this . context . bindRenderbuffer ( target , value ) ;
134134 }
135135
136- _lastTexture : {
137- target : number ,
138- texture : number
139- } = { target : 0 , texture : 0 }
136+ _lastTexture : {
137+ target : number ;
138+ texture : number ;
139+ } = { target : 0 , texture : 0 } ;
140140 bindTexture ( target : number , texture : WebGLTexture ) : void {
141141 this . _glCheckError ( 'bindTexture' ) ;
142142 this . _checkArgs ( 'bindTexture' , arguments ) ;
143143 const value = texture ? texture . native : 0 ;
144- if ( value > 0 ) {
144+ if ( value > 0 ) {
145145 this . _lastTexture = {
146- target, texture : value
146+ target,
147+ texture : value ,
147148 } ;
148149 }
149150
@@ -695,19 +696,19 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
695696 return new Float32Array ( this . getJSArray ( value ) ) ;
696697 case this . ARRAY_BUFFER_BINDING :
697698 case this . ELEMENT_ARRAY_BUFFER_BINDING :
698- if ( value ) {
699+ if ( value ) {
699700 new WebGLBuffer ( WebGLRenderingContext . toPrimitive ( value ) ) ;
700701 }
701702 return null ;
702703 case this . CURRENT_PROGRAM :
703- if ( value ) {
704+ if ( value ) {
704705 return new WebGLProgram ( WebGLRenderingContext . toPrimitive ( value ) ) ;
705706 }
706707 return null ;
707708 case this . COMPRESSED_TEXTURE_FORMATS :
708709 return new Uint32Array ( this . getJSArray ( value ) ) ;
709710 case this . RENDERBUFFER_BINDING :
710- if ( value ) {
711+ if ( value ) {
711712 return new WebGLRenderbuffer ( WebGLRenderingContext . toPrimitive ( value ) ) ;
712713 }
713714 return null ;
@@ -1039,7 +1040,13 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
10391040 this . context . texImage2D ( target , level , internalformat , width , height , border , format , type , this . toNativeArray ( pixels as any , 'float' ) ) ;
10401041 }
10411042 } else if ( pixels instanceof ArrayBuffer ) {
1042- this . context . texImage2D ( target , level , internalformat , width , height , border , format , type , this . toNativeArray ( new Uint8Array ( pixels as any ) as any , 'byte' ) ) ;
1043+ // @ts -ignore // ArrayBuffer backed by nio buffer
1044+ if ( pixels . nativeObject ) {
1045+ // @ts -ignore
1046+ this . context . texImage2D ( target , level , internalformat , width , height , border , format , type , pixels . nativeObject ) ;
1047+ } else {
1048+ this . context . texImage2D ( target , level , internalformat , width , height , border , format , type , this . toNativeArray ( new Uint8Array ( pixels as any ) as any , 'byte' ) ) ;
1049+ }
10431050 } else {
10441051 this . context . texImage2D ( target , level , internalformat , width , height , border , format , type , pixels as any ) ;
10451052 }
@@ -1147,7 +1154,7 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
11471154 uniform1fv ( location : WebGLUniformLocation , value : number [ ] ) : void {
11481155 this . _glCheckError ( 'uniform1fv' ) ;
11491156 this . _checkArgs ( 'uniform1fv' , arguments ) ;
1150- value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
1157+ value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
11511158 const loc = location ? location . native : 0 ;
11521159 this . context . uniform1fv ( loc , value ) ;
11531160 }
@@ -1169,15 +1176,15 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
11691176 uniform2iv ( location : WebGLUniformLocation , value : number [ ] ) : void {
11701177 this . _glCheckError ( 'uniform2iv' ) ;
11711178 this . _checkArgs ( 'uniform2iv' , arguments ) ;
1172- value = Array . from ( value ) ; //this.toNativeArray(value, 'int');
1179+ value = Array . from ( value ) ; //this.toNativeArray(value, 'int');
11731180 const loc = location ? location . native : 0 ;
11741181 this . context . uniform2iv ( loc , value ) ;
11751182 }
11761183
11771184 uniform2fv ( location : WebGLUniformLocation , value : number [ ] ) : void {
11781185 this . _glCheckError ( 'uniform2fv' ) ;
11791186 this . _checkArgs ( 'uniform2fv' , arguments ) ;
1180- value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
1187+ value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
11811188 const loc = location ? location . native : 0 ;
11821189 this . context . uniform2fv ( loc , value ) ;
11831190 }
@@ -1199,15 +1206,15 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
11991206 uniform3iv ( location : WebGLUniformLocation , value : number [ ] ) : void {
12001207 this . _glCheckError ( 'uniform3iv' ) ;
12011208 this . _checkArgs ( 'uniform3iv' , arguments ) ;
1202- value = Array . from ( value ) ; //this.toNativeArray(value, 'int');
1209+ value = Array . from ( value ) ; //this.toNativeArray(value, 'int');
12031210 const loc = location ? location . native : 0 ;
12041211 this . context . uniform3iv ( loc , value ) ;
12051212 }
12061213
12071214 uniform3fv ( location : WebGLUniformLocation , value : number [ ] ) : void {
12081215 this . _glCheckError ( 'uniform3fv' ) ;
12091216 this . _checkArgs ( 'uniform3fv' , arguments ) ;
1210- value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
1217+ value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
12111218 const loc = location ? location . native : 0 ;
12121219 this . context . uniform3fv ( loc , value ) ;
12131220 }
@@ -1229,15 +1236,15 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
12291236 uniform4iv ( location : WebGLUniformLocation , value : number [ ] ) : void {
12301237 this . _glCheckError ( 'uniform4iv' ) ;
12311238 this . _checkArgs ( 'uniform4iv' , arguments ) ;
1232- value = Array . from ( value ) ; //this.toNativeArray(value, 'int');
1239+ value = Array . from ( value ) ; //this.toNativeArray(value, 'int');
12331240 const loc = location ? location . native : 0 ;
12341241 this . context . uniform4iv ( loc , value ) ;
12351242 }
12361243
12371244 uniform4fv ( location : WebGLUniformLocation , value : number [ ] ) : void {
12381245 this . _glCheckError ( 'uniform4fv' ) ;
12391246 this . _checkArgs ( 'uniform4fv' , arguments ) ;
1240- value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
1247+ value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
12411248 const loc = location ? location . native : 0 ;
12421249 this . context . uniform4fv ( loc , value ) ;
12431250 }
@@ -1252,23 +1259,23 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
12521259 uniformMatrix2fv ( location : WebGLUniformLocation , transpose : boolean , value : number [ ] ) : void {
12531260 this . _glCheckError ( 'uniformMatrix2fv' ) ;
12541261 this . _checkArgs ( 'uniformMatrix2fv' , arguments ) ;
1255- value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
1262+ value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
12561263 const loc = location ? location . native : 0 ;
12571264 this . context . uniformMatrix2fv ( loc , transpose , value ) ;
12581265 }
12591266
12601267 uniformMatrix3fv ( location : WebGLUniformLocation , transpose : boolean , value : number [ ] ) : void {
12611268 this . _glCheckError ( 'uniformMatrix3fv' ) ;
12621269 this . _checkArgs ( 'uniformMatrix3fv' , arguments ) ;
1263- value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
1270+ value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
12641271 const loc = location ? location . native : 0 ;
12651272 this . context . uniformMatrix3fv ( loc , transpose , value ) ;
12661273 }
12671274
12681275 uniformMatrix4fv ( location : WebGLUniformLocation , transpose : boolean , value : number [ ] ) : void {
12691276 this . _glCheckError ( 'uniformMatrix4fv' ) ;
12701277 this . _checkArgs ( 'uniformMatrix4fv' , arguments ) ;
1271- value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
1278+ value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
12721279 const loc = location ? location . native : 0 ;
12731280 this . context . uniformMatrix4fv ( loc , transpose , value ) ;
12741281 }
@@ -1296,7 +1303,7 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
12961303 vertexAttrib1fv ( index : number , value : number [ ] ) : void {
12971304 this . _glCheckError ( 'vertexAttrib1fv' ) ;
12981305 this . _checkArgs ( 'vertexAttrib1fv' , arguments ) ;
1299- value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
1306+ value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
13001307 this . context . vertexAttrib1fv ( index , value ) ;
13011308 }
13021309
@@ -1309,7 +1316,7 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
13091316 vertexAttrib2fv ( index : number , value : number [ ] ) : void {
13101317 this . _glCheckError ( 'vertexAttrib2fv' ) ;
13111318 this . _checkArgs ( 'vertexAttrib2fv' , arguments ) ;
1312- value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
1319+ value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
13131320 this . context . vertexAttrib2fv ( index , value ) ;
13141321 }
13151322
@@ -1322,7 +1329,7 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
13221329 vertexAttrib3fv ( index : number , value : number [ ] ) : void {
13231330 this . _glCheckError ( 'vertexAttrib3fv' ) ;
13241331 this . _checkArgs ( 'vertexAttrib3fv' , arguments ) ;
1325- value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
1332+ value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
13261333 this . context . vertexAttrib3fv ( index , value ) ;
13271334 }
13281335
@@ -1335,7 +1342,7 @@ export class WebGLRenderingContext extends WebGLRenderingContextBase {
13351342 vertexAttrib4fv ( index : number , value : number [ ] ) : void {
13361343 this . _glCheckError ( 'vertexAttrib4fv' ) ;
13371344 this . _checkArgs ( 'vertexAttrib4fv' , arguments ) ;
1338- value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
1345+ value = Array . from ( value ) ; //this.toNativeArray(value, 'float');
13391346 this . context . vertexAttrib4fv ( index , value ) ;
13401347 }
13411348
0 commit comments