@lightningjs/renderer 3.0.2 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -196
- package/dist/src/core/CoreNode.js +25 -4
- package/dist/src/core/CoreNode.js.map +1 -1
- package/dist/src/core/CoreTextNode.d.ts +9 -2
- package/dist/src/core/CoreTextNode.js +32 -11
- package/dist/src/core/CoreTextNode.js.map +1 -1
- package/dist/src/core/CoreTextureManager.d.ts +8 -0
- package/dist/src/core/CoreTextureManager.js +13 -1
- package/dist/src/core/CoreTextureManager.js.map +1 -1
- package/dist/src/core/Stage.d.ts +8 -0
- package/dist/src/core/Stage.js +23 -0
- package/dist/src/core/Stage.js.map +1 -1
- package/dist/src/core/TextureMemoryManager.d.ts +8 -13
- package/dist/src/core/TextureMemoryManager.js +22 -27
- package/dist/src/core/TextureMemoryManager.js.map +1 -1
- package/dist/src/core/lib/ImageWorker.d.ts +2 -2
- package/dist/src/core/lib/ImageWorker.js +31 -12
- package/dist/src/core/lib/ImageWorker.js.map +1 -1
- package/dist/src/core/lib/WebGlContextWrapper.d.ts +105 -56
- package/dist/src/core/lib/WebGlContextWrapper.js +164 -158
- package/dist/src/core/lib/WebGlContextWrapper.js.map +1 -1
- package/dist/src/core/lib/textureCompression.js +19 -10
- package/dist/src/core/lib/textureCompression.js.map +1 -1
- package/dist/src/core/lib/validateImageBitmap.d.ts +2 -1
- package/dist/src/core/lib/validateImageBitmap.js +4 -4
- package/dist/src/core/lib/validateImageBitmap.js.map +1 -1
- package/dist/src/core/platform.js +2 -2
- package/dist/src/core/platform.js.map +1 -1
- package/dist/src/core/platforms/Platform.d.ts +4 -0
- package/dist/src/core/platforms/Platform.js.map +1 -1
- package/dist/src/core/platforms/web/WebPlatform.d.ts +2 -0
- package/dist/src/core/platforms/web/WebPlatform.js +13 -0
- package/dist/src/core/platforms/web/WebPlatform.js.map +1 -1
- package/dist/src/core/renderers/CoreRenderer.d.ts +6 -0
- package/dist/src/core/renderers/CoreRenderer.js +8 -0
- package/dist/src/core/renderers/CoreRenderer.js.map +1 -1
- package/dist/src/core/renderers/canvas/CanvasRenderer.d.ts +1 -0
- package/dist/src/core/renderers/canvas/CanvasRenderer.js +5 -0
- package/dist/src/core/renderers/canvas/CanvasRenderer.js.map +1 -1
- package/dist/src/core/renderers/webgl/WebGlRenderOp.d.ts +45 -0
- package/dist/src/core/renderers/webgl/WebGlRenderOp.js +127 -0
- package/dist/src/core/renderers/webgl/WebGlRenderOp.js.map +1 -0
- package/dist/src/core/renderers/webgl/WebGlRenderer.d.ts +2 -0
- package/dist/src/core/renderers/webgl/WebGlRenderer.js +30 -22
- package/dist/src/core/renderers/webgl/WebGlRenderer.js.map +1 -1
- package/dist/src/core/text-rendering/CanvasFont.d.ts +14 -0
- package/dist/src/core/text-rendering/CanvasFont.js +120 -0
- package/dist/src/core/text-rendering/CanvasFont.js.map +1 -0
- package/dist/src/core/text-rendering/CanvasTextRenderer.d.ts +1 -2
- package/dist/src/core/text-rendering/CanvasTextRenderer.js +11 -19
- package/dist/src/core/text-rendering/CanvasTextRenderer.js.map +1 -1
- package/dist/src/core/text-rendering/CoreFont.d.ts +33 -0
- package/dist/src/core/text-rendering/CoreFont.js +48 -0
- package/dist/src/core/text-rendering/CoreFont.js.map +1 -0
- package/dist/src/core/text-rendering/FontManager.d.ts +11 -0
- package/dist/src/core/text-rendering/FontManager.js +41 -0
- package/dist/src/core/text-rendering/FontManager.js.map +1 -0
- package/dist/src/core/text-rendering/SdfFont.d.ts +29 -0
- package/dist/src/core/text-rendering/SdfFont.js +142 -0
- package/dist/src/core/text-rendering/SdfFont.js.map +1 -0
- package/dist/src/core/text-rendering/SdfTextRenderer.d.ts +2 -2
- package/dist/src/core/text-rendering/SdfTextRenderer.js +141 -132
- package/dist/src/core/text-rendering/SdfTextRenderer.js.map +1 -1
- package/dist/src/core/text-rendering/TextGenerator.d.ts +10 -0
- package/dist/src/core/text-rendering/TextGenerator.js +36 -0
- package/dist/src/core/text-rendering/TextGenerator.js.map +1 -0
- package/dist/src/core/text-rendering/TextRenderer.d.ts +26 -20
- package/dist/src/core/text-rendering/Utils.d.ts +2 -0
- package/dist/src/core/text-rendering/Utils.js +3 -0
- package/dist/src/core/text-rendering/Utils.js.map +1 -1
- package/dist/src/main-api/Renderer.d.ts +14 -0
- package/dist/src/main-api/Renderer.js +29 -3
- package/dist/src/main-api/Renderer.js.map +1 -1
- package/dist/tsconfig.dist.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/core/CoreNode.ts +29 -4
- package/src/core/CoreTextNode.test.ts +237 -0
- package/src/core/CoreTextNode.ts +53 -33
- package/src/core/CoreTextureManager.ts +14 -2
- package/src/core/Stage.ts +29 -0
- package/src/core/TextureMemoryManager.test.ts +134 -0
- package/src/core/TextureMemoryManager.ts +23 -30
- package/src/core/platforms/Platform.ts +5 -0
- package/src/core/platforms/web/WebPlatform.ts +13 -0
- package/src/core/renderers/CoreRenderer.ts +10 -0
- package/src/core/renderers/canvas/CanvasRenderer.ts +6 -0
- package/src/core/renderers/webgl/WebGlRenderer.rtt.test.ts +551 -0
- package/src/core/renderers/webgl/WebGlRenderer.ts +38 -28
- package/src/core/text-rendering/CanvasTextRenderer.ts +13 -41
- package/src/core/text-rendering/SdfTextRenderer.ts +166 -163
- package/src/core/text-rendering/TextRenderer.ts +23 -21
- package/src/core/text-rendering/Utils.ts +5 -1
- package/src/main-api/Renderer.test.ts +153 -0
- package/src/main-api/Renderer.ts +33 -3
- package/dist/src/core/renderers/webgl/WebGlCoreShader.destroy.d.ts +0 -1
- package/dist/src/core/renderers/webgl/WebGlCoreShader.destroy.js +0 -2
- package/dist/src/core/renderers/webgl/WebGlCoreShader.destroy.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
|
4
|
-
import { assertTruthy } from '../../utils.js';
|
|
4
|
+
import { assertTruthy, isProductionEnvironment } from '../../utils.js';
|
|
5
5
|
import { isWebGl2 } from '../renderers/webgl/internal/WebGlUtils.js';
|
|
6
6
|
/**
|
|
7
7
|
* Optimized WebGL Context Wrapper
|
|
@@ -41,6 +41,7 @@ export class WebGlContextWrapper {
|
|
|
41
41
|
boundArrayBuffer;
|
|
42
42
|
boundElementArrayBuffer;
|
|
43
43
|
curProgram;
|
|
44
|
+
curUniformLocations = {};
|
|
44
45
|
//#endregion Cached WebGL State
|
|
45
46
|
//#region Canvas
|
|
46
47
|
canvas;
|
|
@@ -178,9 +179,8 @@ export class WebGlContextWrapper {
|
|
|
178
179
|
* @param textureUnit
|
|
179
180
|
*/
|
|
180
181
|
activeTexture(textureUnit) {
|
|
181
|
-
const { gl } = this;
|
|
182
182
|
if (this.activeTextureUnit !== textureUnit) {
|
|
183
|
-
gl.activeTexture(textureUnit + gl.TEXTURE0);
|
|
183
|
+
this.gl.activeTexture(textureUnit + this.gl.TEXTURE0);
|
|
184
184
|
this.activeTextureUnit = textureUnit;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
@@ -194,16 +194,14 @@ export class WebGlContextWrapper {
|
|
|
194
194
|
* @param texture
|
|
195
195
|
*/
|
|
196
196
|
bindTexture(texture) {
|
|
197
|
-
|
|
198
|
-
if (texture2dUnits[activeTextureUnit] === texture) {
|
|
197
|
+
if (this.texture2dUnits[this.activeTextureUnit] === texture) {
|
|
199
198
|
return;
|
|
200
199
|
}
|
|
201
|
-
texture2dUnits[activeTextureUnit] = texture;
|
|
202
|
-
gl.bindTexture(this.gl.TEXTURE_2D, texture);
|
|
200
|
+
this.texture2dUnits[this.activeTextureUnit] = texture;
|
|
201
|
+
this.gl.bindTexture(this.gl.TEXTURE_2D, texture);
|
|
203
202
|
}
|
|
204
203
|
_getActiveTexture() {
|
|
205
|
-
|
|
206
|
-
return texture2dUnits[activeTextureUnit];
|
|
204
|
+
return this.texture2dUnits[this.activeTextureUnit];
|
|
207
205
|
}
|
|
208
206
|
/**
|
|
209
207
|
* ```
|
|
@@ -217,29 +215,27 @@ export class WebGlContextWrapper {
|
|
|
217
215
|
* @returns
|
|
218
216
|
*/
|
|
219
217
|
texParameteri(pname, param) {
|
|
220
|
-
const { gl, texture2dParams } = this;
|
|
221
218
|
const activeTexture = this._getActiveTexture();
|
|
222
219
|
if (!activeTexture) {
|
|
223
220
|
throw new Error('No active texture');
|
|
224
221
|
}
|
|
225
|
-
let textureParams = texture2dParams.get(activeTexture);
|
|
222
|
+
let textureParams = this.texture2dParams.get(activeTexture);
|
|
226
223
|
if (!textureParams) {
|
|
227
224
|
textureParams = {};
|
|
228
|
-
texture2dParams.set(activeTexture, textureParams);
|
|
225
|
+
this.texture2dParams.set(activeTexture, textureParams);
|
|
229
226
|
}
|
|
230
227
|
if (textureParams[pname] === param) {
|
|
231
228
|
return;
|
|
232
229
|
}
|
|
233
230
|
textureParams[pname] = param;
|
|
234
|
-
gl.texParameteri(gl.TEXTURE_2D, pname, param);
|
|
231
|
+
this.gl.texParameteri(this.gl.TEXTURE_2D, pname, param);
|
|
235
232
|
}
|
|
236
233
|
texImage2D(level, internalFormat, widthOrFormat, heightOrType, borderOrSource, format, type, pixels) {
|
|
237
|
-
const { gl } = this;
|
|
238
234
|
if (format) {
|
|
239
|
-
gl.texImage2D(gl.TEXTURE_2D, level, internalFormat, widthOrFormat, heightOrType, borderOrSource, format, type, pixels);
|
|
235
|
+
this.gl.texImage2D(this.gl.TEXTURE_2D, level, internalFormat, widthOrFormat, heightOrType, borderOrSource, format, type, pixels);
|
|
240
236
|
}
|
|
241
237
|
else {
|
|
242
|
-
gl.texImage2D(gl.TEXTURE_2D, level, internalFormat, widthOrFormat, heightOrType, borderOrSource);
|
|
238
|
+
this.gl.texImage2D(this.gl.TEXTURE_2D, level, internalFormat, widthOrFormat, heightOrType, borderOrSource);
|
|
243
239
|
}
|
|
244
240
|
}
|
|
245
241
|
/**
|
|
@@ -251,8 +247,7 @@ export class WebGlContextWrapper {
|
|
|
251
247
|
* **WebGL Difference**: Bind target is always `gl.TEXTURE_2D`
|
|
252
248
|
*/
|
|
253
249
|
compressedTexImage2D(level, internalformat, width, height, border, data) {
|
|
254
|
-
|
|
255
|
-
gl.compressedTexImage2D(gl.TEXTURE_2D, level, internalformat, width, height, border, data);
|
|
250
|
+
this.gl.compressedTexImage2D(this.gl.TEXTURE_2D, level, internalformat, width, height, border, data);
|
|
256
251
|
}
|
|
257
252
|
/**
|
|
258
253
|
* ```
|
|
@@ -263,8 +258,7 @@ export class WebGlContextWrapper {
|
|
|
263
258
|
* @param param
|
|
264
259
|
*/
|
|
265
260
|
pixelStorei(pname, param) {
|
|
266
|
-
|
|
267
|
-
gl.pixelStorei(pname, param);
|
|
261
|
+
this.gl.pixelStorei(pname, param);
|
|
268
262
|
}
|
|
269
263
|
/**
|
|
270
264
|
* ```
|
|
@@ -275,8 +269,7 @@ export class WebGlContextWrapper {
|
|
|
275
269
|
* **WebGL Difference**: Bind target is always `gl.TEXTURE_2D`
|
|
276
270
|
*/
|
|
277
271
|
generateMipmap() {
|
|
278
|
-
|
|
279
|
-
gl.generateMipmap(gl.TEXTURE_2D);
|
|
272
|
+
this.gl.generateMipmap(this.gl.TEXTURE_2D);
|
|
280
273
|
}
|
|
281
274
|
/**
|
|
282
275
|
* ```
|
|
@@ -286,8 +279,7 @@ export class WebGlContextWrapper {
|
|
|
286
279
|
* @returns
|
|
287
280
|
*/
|
|
288
281
|
createTexture() {
|
|
289
|
-
|
|
290
|
-
return gl.createTexture();
|
|
282
|
+
return this.gl.createTexture();
|
|
291
283
|
}
|
|
292
284
|
/**
|
|
293
285
|
* ```
|
|
@@ -297,11 +289,10 @@ export class WebGlContextWrapper {
|
|
|
297
289
|
* @param texture
|
|
298
290
|
*/
|
|
299
291
|
deleteTexture(texture) {
|
|
300
|
-
const { gl } = this;
|
|
301
292
|
if (texture) {
|
|
302
293
|
this.texture2dParams.delete(texture);
|
|
303
294
|
}
|
|
304
|
-
gl.deleteTexture(texture);
|
|
295
|
+
this.gl.deleteTexture(texture);
|
|
305
296
|
}
|
|
306
297
|
/**
|
|
307
298
|
* ```
|
|
@@ -318,8 +309,7 @@ export class WebGlContextWrapper {
|
|
|
318
309
|
* ```
|
|
319
310
|
*/
|
|
320
311
|
viewport(x, y, width, height) {
|
|
321
|
-
|
|
322
|
-
gl.viewport(x, y, width, height);
|
|
312
|
+
this.gl.viewport(x, y, width, height);
|
|
323
313
|
}
|
|
324
314
|
/**
|
|
325
315
|
* ```
|
|
@@ -332,8 +322,7 @@ export class WebGlContextWrapper {
|
|
|
332
322
|
* @param alpha
|
|
333
323
|
*/
|
|
334
324
|
clearColor(red, green, blue, alpha) {
|
|
335
|
-
|
|
336
|
-
gl.clearColor(red, green, blue, alpha);
|
|
325
|
+
this.gl.clearColor(red, green, blue, alpha);
|
|
337
326
|
}
|
|
338
327
|
/**
|
|
339
328
|
* ```
|
|
@@ -342,15 +331,14 @@ export class WebGlContextWrapper {
|
|
|
342
331
|
* @param enable
|
|
343
332
|
*/
|
|
344
333
|
setScissorTest(enable) {
|
|
345
|
-
|
|
346
|
-
if (enable === scissorEnabled) {
|
|
334
|
+
if (enable === this.scissorEnabled) {
|
|
347
335
|
return;
|
|
348
336
|
}
|
|
349
337
|
if (enable) {
|
|
350
|
-
gl.enable(gl.SCISSOR_TEST);
|
|
338
|
+
this.gl.enable(this.gl.SCISSOR_TEST);
|
|
351
339
|
}
|
|
352
340
|
else {
|
|
353
|
-
gl.disable(gl.SCISSOR_TEST);
|
|
341
|
+
this.gl.disable(this.gl.SCISSOR_TEST);
|
|
354
342
|
}
|
|
355
343
|
this.scissorEnabled = enable;
|
|
356
344
|
}
|
|
@@ -365,12 +353,11 @@ export class WebGlContextWrapper {
|
|
|
365
353
|
* @param height
|
|
366
354
|
*/
|
|
367
355
|
scissor(x, y, width, height) {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
gl.scissor(x, y, width, height);
|
|
356
|
+
if (x !== this.scissorX ||
|
|
357
|
+
y !== this.scissorY ||
|
|
358
|
+
width !== this.scissorWidth ||
|
|
359
|
+
height !== this.scissorHeight) {
|
|
360
|
+
this.gl.scissor(x, y, width, height);
|
|
374
361
|
this.scissorX = x;
|
|
375
362
|
this.scissorY = y;
|
|
376
363
|
this.scissorWidth = width;
|
|
@@ -386,15 +373,14 @@ export class WebGlContextWrapper {
|
|
|
386
373
|
* @returns
|
|
387
374
|
*/
|
|
388
375
|
setBlend(blend) {
|
|
389
|
-
|
|
390
|
-
if (blend === blendEnabled) {
|
|
376
|
+
if (blend === this.blendEnabled) {
|
|
391
377
|
return;
|
|
392
378
|
}
|
|
393
379
|
if (blend) {
|
|
394
|
-
gl.enable(gl.BLEND);
|
|
380
|
+
this.gl.enable(this.gl.BLEND);
|
|
395
381
|
}
|
|
396
382
|
else {
|
|
397
|
-
gl.disable(gl.BLEND);
|
|
383
|
+
this.gl.disable(this.gl.BLEND);
|
|
398
384
|
}
|
|
399
385
|
this.blendEnabled = blend;
|
|
400
386
|
}
|
|
@@ -407,12 +393,11 @@ export class WebGlContextWrapper {
|
|
|
407
393
|
* @param dst
|
|
408
394
|
*/
|
|
409
395
|
blendFunc(src, dst) {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
dst
|
|
415
|
-
gl.blendFunc(src, dst);
|
|
396
|
+
if (src !== this.blendSrcRgb ||
|
|
397
|
+
dst !== this.blendDstRgb ||
|
|
398
|
+
src !== this.blendSrcAlpha ||
|
|
399
|
+
dst !== this.blendDstAlpha) {
|
|
400
|
+
this.gl.blendFunc(src, dst);
|
|
416
401
|
this.blendSrcRgb = src;
|
|
417
402
|
this.blendDstRgb = dst;
|
|
418
403
|
this.blendSrcAlpha = src;
|
|
@@ -427,8 +412,7 @@ export class WebGlContextWrapper {
|
|
|
427
412
|
* @returns
|
|
428
413
|
*/
|
|
429
414
|
createBuffer() {
|
|
430
|
-
|
|
431
|
-
return gl.createBuffer();
|
|
415
|
+
return this.gl.createBuffer();
|
|
432
416
|
}
|
|
433
417
|
/**
|
|
434
418
|
* ```
|
|
@@ -437,8 +421,7 @@ export class WebGlContextWrapper {
|
|
|
437
421
|
* @returns
|
|
438
422
|
*/
|
|
439
423
|
createFramebuffer() {
|
|
440
|
-
|
|
441
|
-
return gl.createFramebuffer();
|
|
424
|
+
return this.gl.createFramebuffer();
|
|
442
425
|
}
|
|
443
426
|
/**
|
|
444
427
|
* ```
|
|
@@ -448,8 +431,7 @@ export class WebGlContextWrapper {
|
|
|
448
431
|
* @param framebuffer
|
|
449
432
|
*/
|
|
450
433
|
bindFramebuffer(framebuffer) {
|
|
451
|
-
|
|
452
|
-
gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
|
|
434
|
+
this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, framebuffer);
|
|
453
435
|
}
|
|
454
436
|
/**
|
|
455
437
|
* ```
|
|
@@ -459,7 +441,7 @@ export class WebGlContextWrapper {
|
|
|
459
441
|
* **WebGL Difference**: Bind target is always `gl.FRAMEBUFFER` and textarget is always `gl.TEXTURE_2D`
|
|
460
442
|
*/
|
|
461
443
|
framebufferTexture2D(attachment, texture, level) {
|
|
462
|
-
const
|
|
444
|
+
const gl = this.gl;
|
|
463
445
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, texture, level);
|
|
464
446
|
}
|
|
465
447
|
/**
|
|
@@ -471,8 +453,7 @@ export class WebGlContextWrapper {
|
|
|
471
453
|
* **WebGL Difference**: Clear mask is always `gl.COLOR_BUFFER_BIT`
|
|
472
454
|
*/
|
|
473
455
|
clear() {
|
|
474
|
-
|
|
475
|
-
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
456
|
+
this.gl.clear(this.gl.COLOR_BUFFER_BIT);
|
|
476
457
|
}
|
|
477
458
|
/**
|
|
478
459
|
* ```
|
|
@@ -488,12 +469,11 @@ export class WebGlContextWrapper {
|
|
|
488
469
|
* @param usage
|
|
489
470
|
*/
|
|
490
471
|
arrayBufferData(buffer, data, usage) {
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
472
|
+
if (this.boundArrayBuffer !== buffer) {
|
|
473
|
+
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);
|
|
494
474
|
this.boundArrayBuffer = buffer;
|
|
495
475
|
}
|
|
496
|
-
gl.bufferData(gl.ARRAY_BUFFER, data, usage);
|
|
476
|
+
this.gl.bufferData(this.gl.ARRAY_BUFFER, data, usage);
|
|
497
477
|
}
|
|
498
478
|
/**
|
|
499
479
|
* ```
|
|
@@ -508,12 +488,11 @@ export class WebGlContextWrapper {
|
|
|
508
488
|
* @param usage
|
|
509
489
|
*/
|
|
510
490
|
elementArrayBufferData(buffer, data, usage) {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buffer);
|
|
491
|
+
if (this.boundElementArrayBuffer !== buffer) {
|
|
492
|
+
this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, buffer);
|
|
514
493
|
this.boundElementArrayBuffer = buffer;
|
|
515
494
|
}
|
|
516
|
-
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, data, usage);
|
|
495
|
+
this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER, data, usage);
|
|
517
496
|
}
|
|
518
497
|
/**
|
|
519
498
|
* ```
|
|
@@ -533,12 +512,11 @@ export class WebGlContextWrapper {
|
|
|
533
512
|
* @param offset
|
|
534
513
|
*/
|
|
535
514
|
vertexAttribPointer(buffer, index, size, type, normalized, stride, offset) {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
|
515
|
+
if (this.boundArrayBuffer !== buffer) {
|
|
516
|
+
this.gl.bindBuffer(this.gl.ARRAY_BUFFER, buffer);
|
|
539
517
|
this.boundArrayBuffer = buffer;
|
|
540
518
|
}
|
|
541
|
-
gl.vertexAttribPointer(index, size, type, normalized, stride, offset);
|
|
519
|
+
this.gl.vertexAttribPointer(index, size, type, normalized, stride, offset);
|
|
542
520
|
}
|
|
543
521
|
/**
|
|
544
522
|
* Returns object with Attribute names as key and numbers as location values
|
|
@@ -581,13 +559,13 @@ export class WebGlContextWrapper {
|
|
|
581
559
|
* @param program
|
|
582
560
|
* @returns
|
|
583
561
|
*/
|
|
584
|
-
useProgram(program) {
|
|
585
|
-
|
|
586
|
-
if (curProgram === program) {
|
|
562
|
+
useProgram(program, uniformLocations) {
|
|
563
|
+
if (this.curProgram === program) {
|
|
587
564
|
return;
|
|
588
565
|
}
|
|
589
|
-
gl.useProgram(program);
|
|
566
|
+
this.gl.useProgram(program);
|
|
590
567
|
this.curProgram = program;
|
|
568
|
+
this.curUniformLocations = uniformLocations;
|
|
591
569
|
}
|
|
592
570
|
/**
|
|
593
571
|
* Sets the value of a single float uniform variable.
|
|
@@ -596,8 +574,7 @@ export class WebGlContextWrapper {
|
|
|
596
574
|
* @param v0 - The value to set.
|
|
597
575
|
*/
|
|
598
576
|
uniform1f(location, v0) {
|
|
599
|
-
|
|
600
|
-
gl.uniform1f(location, v0);
|
|
577
|
+
this.gl.uniform1f(this.curUniformLocations[location] || null, v0);
|
|
601
578
|
}
|
|
602
579
|
/**
|
|
603
580
|
* Sets the value of a float array uniform variable.
|
|
@@ -606,8 +583,7 @@ export class WebGlContextWrapper {
|
|
|
606
583
|
* @param value - The array of values to set.
|
|
607
584
|
*/
|
|
608
585
|
uniform1fv(location, value) {
|
|
609
|
-
|
|
610
|
-
gl.uniform1fv(location, value);
|
|
586
|
+
this.gl.uniform1fv(this.curUniformLocations[location] || null, value);
|
|
611
587
|
}
|
|
612
588
|
/**
|
|
613
589
|
* Sets the value of a single integer uniform variable.
|
|
@@ -616,8 +592,7 @@ export class WebGlContextWrapper {
|
|
|
616
592
|
* @param v0 - The value to set.
|
|
617
593
|
*/
|
|
618
594
|
uniform1i(location, v0) {
|
|
619
|
-
|
|
620
|
-
gl.uniform1i(location, v0);
|
|
595
|
+
this.gl.uniform1i(this.curUniformLocations[location] || null, v0);
|
|
621
596
|
}
|
|
622
597
|
/**
|
|
623
598
|
* Sets the value of an integer array uniform variable.
|
|
@@ -626,8 +601,7 @@ export class WebGlContextWrapper {
|
|
|
626
601
|
* @param value - The array of values to set.
|
|
627
602
|
*/
|
|
628
603
|
uniform1iv(location, value) {
|
|
629
|
-
|
|
630
|
-
gl.uniform1iv(location, value);
|
|
604
|
+
this.gl.uniform1iv(this.curUniformLocations[location] || null, value);
|
|
631
605
|
}
|
|
632
606
|
/**
|
|
633
607
|
* Sets the value of a vec2 uniform variable.
|
|
@@ -637,8 +611,16 @@ export class WebGlContextWrapper {
|
|
|
637
611
|
* @param v1 - The second component of the vector.
|
|
638
612
|
*/
|
|
639
613
|
uniform2f(location, v0, v1) {
|
|
640
|
-
|
|
641
|
-
|
|
614
|
+
this.gl.uniform2f(this.curUniformLocations[location] || null, v0, v1);
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Sets the value of a vec3 uniform variable.
|
|
618
|
+
*
|
|
619
|
+
* @param location - The location of the uniform variable.
|
|
620
|
+
* @param v - array of 4 numbers.
|
|
621
|
+
*/
|
|
622
|
+
uniform2fa(location, value) {
|
|
623
|
+
this.gl.uniform2f(this.curUniformLocations[location] || null, value[0], value[1]);
|
|
642
624
|
}
|
|
643
625
|
/**
|
|
644
626
|
* Sets the value of a vec2 array uniform variable.
|
|
@@ -647,8 +629,7 @@ export class WebGlContextWrapper {
|
|
|
647
629
|
* @param value - The array of vec2 values to set.
|
|
648
630
|
*/
|
|
649
631
|
uniform2fv(location, value) {
|
|
650
|
-
|
|
651
|
-
gl.uniform2fv(location, value);
|
|
632
|
+
this.gl.uniform2fv(this.curUniformLocations[location] || null, value);
|
|
652
633
|
}
|
|
653
634
|
/**
|
|
654
635
|
* Sets the value of a ivec2 uniform variable.
|
|
@@ -658,8 +639,7 @@ export class WebGlContextWrapper {
|
|
|
658
639
|
* @param v1 - The second component of the vector.
|
|
659
640
|
*/
|
|
660
641
|
uniform2i(location, v0, v1) {
|
|
661
|
-
|
|
662
|
-
gl.uniform2i(location, v0, v1);
|
|
642
|
+
this.gl.uniform2i(this.curUniformLocations[location] || null, v0, v1);
|
|
663
643
|
}
|
|
664
644
|
/**
|
|
665
645
|
* Sets the value of an ivec2 array uniform variable.
|
|
@@ -668,8 +648,7 @@ export class WebGlContextWrapper {
|
|
|
668
648
|
* @param value - The array of ivec2 values to set.
|
|
669
649
|
*/
|
|
670
650
|
uniform2iv(location, value) {
|
|
671
|
-
|
|
672
|
-
gl.uniform2iv(location, value);
|
|
651
|
+
this.gl.uniform2iv(this.curUniformLocations[location] || null, value);
|
|
673
652
|
}
|
|
674
653
|
/**
|
|
675
654
|
* Sets the value of a vec3 uniform variable.
|
|
@@ -680,8 +659,16 @@ export class WebGlContextWrapper {
|
|
|
680
659
|
* @param v2 - The third component of the vector.
|
|
681
660
|
*/
|
|
682
661
|
uniform3f(location, v0, v1, v2) {
|
|
683
|
-
|
|
684
|
-
|
|
662
|
+
this.gl.uniform3f(this.curUniformLocations[location] || null, v0, v1, v2);
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Sets the value of a vec3 uniform variable.
|
|
666
|
+
*
|
|
667
|
+
* @param location - The location of the uniform variable.
|
|
668
|
+
* @param v - array of 4 numbers.
|
|
669
|
+
*/
|
|
670
|
+
uniform3fa(location, value) {
|
|
671
|
+
this.gl.uniform3f(this.curUniformLocations[location] || null, value[0], value[1], value[2]);
|
|
685
672
|
}
|
|
686
673
|
/**
|
|
687
674
|
* Sets the value of a vec3 array uniform variable.
|
|
@@ -690,8 +677,7 @@ export class WebGlContextWrapper {
|
|
|
690
677
|
* @param value - The array of vec3 values to set.
|
|
691
678
|
*/
|
|
692
679
|
uniform3fv(location, value) {
|
|
693
|
-
|
|
694
|
-
gl.uniform3fv(location, value);
|
|
680
|
+
this.gl.uniform3fv(this.curUniformLocations[location] || null, value);
|
|
695
681
|
}
|
|
696
682
|
/**
|
|
697
683
|
* Sets the value of a ivec3 uniform variable.
|
|
@@ -702,8 +688,7 @@ export class WebGlContextWrapper {
|
|
|
702
688
|
* @param v2 - The third component of the vector.
|
|
703
689
|
*/
|
|
704
690
|
uniform3i(location, v0, v1, v2) {
|
|
705
|
-
|
|
706
|
-
gl.uniform3i(location, v0, v1, v2);
|
|
691
|
+
this.gl.uniform3i(this.curUniformLocations[location] || null, v0, v1, v2);
|
|
707
692
|
}
|
|
708
693
|
/**
|
|
709
694
|
* Sets the value of an ivec3 array uniform variable.
|
|
@@ -712,8 +697,7 @@ export class WebGlContextWrapper {
|
|
|
712
697
|
* @param value - The array of ivec3 values to set.
|
|
713
698
|
*/
|
|
714
699
|
uniform3iv(location, value) {
|
|
715
|
-
|
|
716
|
-
gl.uniform3iv(location, value);
|
|
700
|
+
this.gl.uniform3iv(this.curUniformLocations[location] || null, value);
|
|
717
701
|
}
|
|
718
702
|
/**
|
|
719
703
|
* Sets the value of a vec4 uniform variable.
|
|
@@ -725,8 +709,16 @@ export class WebGlContextWrapper {
|
|
|
725
709
|
* @param v3 - The fourth component of the vector.
|
|
726
710
|
*/
|
|
727
711
|
uniform4f(location, v0, v1, v2, v3) {
|
|
728
|
-
|
|
729
|
-
|
|
712
|
+
this.gl.uniform4f(this.curUniformLocations[location] || null, v0, v1, v2, v3);
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* Sets the value of a vec4 uniform variable.
|
|
716
|
+
*
|
|
717
|
+
* @param location - The location of the uniform variable.
|
|
718
|
+
* @param v - array of 4 numbers.
|
|
719
|
+
*/
|
|
720
|
+
uniform4fa(location, value) {
|
|
721
|
+
this.gl.uniform4f(this.curUniformLocations[location] || null, value[0], value[1], value[2], value[3]);
|
|
730
722
|
}
|
|
731
723
|
/**
|
|
732
724
|
* Sets the value of a vec4 array uniform variable.
|
|
@@ -735,8 +727,7 @@ export class WebGlContextWrapper {
|
|
|
735
727
|
* @param value - The array of vec4 values to set.
|
|
736
728
|
*/
|
|
737
729
|
uniform4fv(location, value) {
|
|
738
|
-
|
|
739
|
-
gl.uniform4fv(location, value);
|
|
730
|
+
this.gl.uniform4fv(this.curUniformLocations[location] || null, value);
|
|
740
731
|
}
|
|
741
732
|
/**
|
|
742
733
|
* Sets the value of a ivec4 uniform variable.
|
|
@@ -748,8 +739,7 @@ export class WebGlContextWrapper {
|
|
|
748
739
|
* @param v3 - The fourth component of the vector.
|
|
749
740
|
*/
|
|
750
741
|
uniform4i(location, v0, v1, v2, v3) {
|
|
751
|
-
|
|
752
|
-
gl.uniform4i(location, v0, v1, v2, v3);
|
|
742
|
+
this.gl.uniform4i(this.curUniformLocations[location] || null, v0, v1, v2, v3);
|
|
753
743
|
}
|
|
754
744
|
/**
|
|
755
745
|
* Sets the value of an ivec4 array uniform variable.
|
|
@@ -758,8 +748,7 @@ export class WebGlContextWrapper {
|
|
|
758
748
|
* @param value - The array of ivec4 values to set.
|
|
759
749
|
*/
|
|
760
750
|
uniform4iv(location, value) {
|
|
761
|
-
|
|
762
|
-
gl.uniform4iv(location, value);
|
|
751
|
+
this.gl.uniform4iv(this.curUniformLocations[location] || null, value);
|
|
763
752
|
}
|
|
764
753
|
/**
|
|
765
754
|
* Sets the value of a mat2 uniform variable.
|
|
@@ -769,8 +758,7 @@ export class WebGlContextWrapper {
|
|
|
769
758
|
* @param value - The array of mat2 values to set.
|
|
770
759
|
*/
|
|
771
760
|
uniformMatrix2fv(location, value) {
|
|
772
|
-
|
|
773
|
-
gl.uniformMatrix2fv(location, false, value);
|
|
761
|
+
this.gl.uniformMatrix2fv(this.curUniformLocations[location] || null, false, value);
|
|
774
762
|
}
|
|
775
763
|
/**
|
|
776
764
|
* Sets the value of a mat2 uniform variable.
|
|
@@ -778,8 +766,7 @@ export class WebGlContextWrapper {
|
|
|
778
766
|
* @param value - The array of mat2 values to set.
|
|
779
767
|
*/
|
|
780
768
|
uniformMatrix3fv(location, value) {
|
|
781
|
-
|
|
782
|
-
gl.uniformMatrix3fv(location, false, value);
|
|
769
|
+
this.gl.uniformMatrix3fv(this.curUniformLocations[location] || null, false, value);
|
|
783
770
|
}
|
|
784
771
|
/**
|
|
785
772
|
* Sets the value of a mat4 uniform variable.
|
|
@@ -787,8 +774,7 @@ export class WebGlContextWrapper {
|
|
|
787
774
|
* @param value - The array of mat4 values to set.
|
|
788
775
|
*/
|
|
789
776
|
uniformMatrix4fv(location, value) {
|
|
790
|
-
|
|
791
|
-
gl.uniformMatrix4fv(location, false, value);
|
|
777
|
+
this.gl.uniformMatrix4fv(this.curUniformLocations[location] || null, false, value);
|
|
792
778
|
}
|
|
793
779
|
/**
|
|
794
780
|
* ```
|
|
@@ -799,8 +785,7 @@ export class WebGlContextWrapper {
|
|
|
799
785
|
* @returns
|
|
800
786
|
*/
|
|
801
787
|
getParameter(pname) {
|
|
802
|
-
|
|
803
|
-
return gl.getParameter(pname);
|
|
788
|
+
return this.gl.getParameter(pname);
|
|
804
789
|
}
|
|
805
790
|
/**
|
|
806
791
|
* ```
|
|
@@ -813,8 +798,19 @@ export class WebGlContextWrapper {
|
|
|
813
798
|
* @param offset
|
|
814
799
|
*/
|
|
815
800
|
drawElements(mode, count, type, offset) {
|
|
816
|
-
|
|
817
|
-
|
|
801
|
+
this.gl.drawElements(mode, count, type, offset);
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* ```
|
|
805
|
+
* gl.drawArrays(mode, first, count);
|
|
806
|
+
* ```
|
|
807
|
+
*
|
|
808
|
+
* @param mode
|
|
809
|
+
* @param first
|
|
810
|
+
* @param count
|
|
811
|
+
*/
|
|
812
|
+
drawArrays(mode, first, count) {
|
|
813
|
+
this.gl.drawArrays(mode, first, count);
|
|
818
814
|
}
|
|
819
815
|
/**
|
|
820
816
|
* ```
|
|
@@ -825,8 +821,7 @@ export class WebGlContextWrapper {
|
|
|
825
821
|
* @returns
|
|
826
822
|
*/
|
|
827
823
|
getExtension(name) {
|
|
828
|
-
|
|
829
|
-
return gl.getExtension(name);
|
|
824
|
+
return this.gl.getExtension(name);
|
|
830
825
|
}
|
|
831
826
|
/**
|
|
832
827
|
* ```
|
|
@@ -836,8 +831,7 @@ export class WebGlContextWrapper {
|
|
|
836
831
|
* @returns
|
|
837
832
|
*/
|
|
838
833
|
getError() {
|
|
839
|
-
|
|
840
|
-
return gl.getError();
|
|
834
|
+
return this.gl.getError();
|
|
841
835
|
}
|
|
842
836
|
/**
|
|
843
837
|
* ```
|
|
@@ -847,9 +841,10 @@ export class WebGlContextWrapper {
|
|
|
847
841
|
* @returns
|
|
848
842
|
*/
|
|
849
843
|
createVertexArray() {
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
844
|
+
if (this.gl instanceof WebGL2RenderingContext) {
|
|
845
|
+
return this.gl.createVertexArray();
|
|
846
|
+
}
|
|
847
|
+
return undefined;
|
|
853
848
|
}
|
|
854
849
|
/**
|
|
855
850
|
* ```
|
|
@@ -859,9 +854,9 @@ export class WebGlContextWrapper {
|
|
|
859
854
|
* @param vertexArray
|
|
860
855
|
*/
|
|
861
856
|
bindVertexArray(vertexArray) {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
857
|
+
if (this.gl instanceof WebGL2RenderingContext) {
|
|
858
|
+
this.gl.bindVertexArray(vertexArray);
|
|
859
|
+
}
|
|
865
860
|
}
|
|
866
861
|
/**
|
|
867
862
|
* ```
|
|
@@ -873,8 +868,7 @@ export class WebGlContextWrapper {
|
|
|
873
868
|
* @returns
|
|
874
869
|
*/
|
|
875
870
|
getAttribLocation(program, name) {
|
|
876
|
-
|
|
877
|
-
return gl.getAttribLocation(program, name);
|
|
871
|
+
return this.gl.getAttribLocation(program, name);
|
|
878
872
|
}
|
|
879
873
|
/**
|
|
880
874
|
* ```
|
|
@@ -886,8 +880,7 @@ export class WebGlContextWrapper {
|
|
|
886
880
|
* @returns
|
|
887
881
|
*/
|
|
888
882
|
getUniformLocation(program, name) {
|
|
889
|
-
|
|
890
|
-
return gl.getUniformLocation(program, name);
|
|
883
|
+
return this.gl.getUniformLocation(program, name);
|
|
891
884
|
}
|
|
892
885
|
/**
|
|
893
886
|
* ```
|
|
@@ -897,8 +890,7 @@ export class WebGlContextWrapper {
|
|
|
897
890
|
* @param index
|
|
898
891
|
*/
|
|
899
892
|
enableVertexAttribArray(index) {
|
|
900
|
-
|
|
901
|
-
gl.enableVertexAttribArray(index);
|
|
893
|
+
this.gl.enableVertexAttribArray(index);
|
|
902
894
|
}
|
|
903
895
|
/**
|
|
904
896
|
* ```
|
|
@@ -908,8 +900,7 @@ export class WebGlContextWrapper {
|
|
|
908
900
|
* @param index
|
|
909
901
|
*/
|
|
910
902
|
disableVertexAttribArray(index) {
|
|
911
|
-
|
|
912
|
-
gl.disableVertexAttribArray(index);
|
|
903
|
+
this.gl.disableVertexAttribArray(index);
|
|
913
904
|
}
|
|
914
905
|
/**
|
|
915
906
|
* ```
|
|
@@ -920,8 +911,7 @@ export class WebGlContextWrapper {
|
|
|
920
911
|
* @returns
|
|
921
912
|
*/
|
|
922
913
|
createShader(type) {
|
|
923
|
-
|
|
924
|
-
return gl.createShader(type);
|
|
914
|
+
return this.gl.createShader(type);
|
|
925
915
|
}
|
|
926
916
|
/**
|
|
927
917
|
* ```
|
|
@@ -932,8 +922,7 @@ export class WebGlContextWrapper {
|
|
|
932
922
|
* @returns
|
|
933
923
|
*/
|
|
934
924
|
compileShader(shader) {
|
|
935
|
-
|
|
936
|
-
gl.compileShader(shader);
|
|
925
|
+
this.gl.compileShader(shader);
|
|
937
926
|
}
|
|
938
927
|
/**
|
|
939
928
|
* ```
|
|
@@ -944,8 +933,7 @@ export class WebGlContextWrapper {
|
|
|
944
933
|
* @param shader
|
|
945
934
|
*/
|
|
946
935
|
attachShader(program, shader) {
|
|
947
|
-
|
|
948
|
-
gl.attachShader(program, shader);
|
|
936
|
+
this.gl.attachShader(program, shader);
|
|
949
937
|
}
|
|
950
938
|
/**
|
|
951
939
|
* ```
|
|
@@ -955,8 +943,7 @@ export class WebGlContextWrapper {
|
|
|
955
943
|
* @param program
|
|
956
944
|
*/
|
|
957
945
|
linkProgram(program) {
|
|
958
|
-
|
|
959
|
-
gl.linkProgram(program);
|
|
946
|
+
this.gl.linkProgram(program);
|
|
960
947
|
}
|
|
961
948
|
/**
|
|
962
949
|
* ```
|
|
@@ -966,8 +953,7 @@ export class WebGlContextWrapper {
|
|
|
966
953
|
* @param shader
|
|
967
954
|
*/
|
|
968
955
|
deleteProgram(shader) {
|
|
969
|
-
|
|
970
|
-
gl.deleteProgram(shader);
|
|
956
|
+
this.gl.deleteProgram(shader);
|
|
971
957
|
}
|
|
972
958
|
/**
|
|
973
959
|
* ```
|
|
@@ -978,8 +964,7 @@ export class WebGlContextWrapper {
|
|
|
978
964
|
* @param pname
|
|
979
965
|
*/
|
|
980
966
|
getShaderParameter(shader, pname) {
|
|
981
|
-
|
|
982
|
-
return gl.getShaderParameter(shader, pname);
|
|
967
|
+
return this.gl.getShaderParameter(shader, pname);
|
|
983
968
|
}
|
|
984
969
|
/**
|
|
985
970
|
* ```
|
|
@@ -989,8 +974,7 @@ export class WebGlContextWrapper {
|
|
|
989
974
|
* @param shader
|
|
990
975
|
*/
|
|
991
976
|
getShaderInfoLog(shader) {
|
|
992
|
-
|
|
993
|
-
return gl.getShaderInfoLog(shader);
|
|
977
|
+
return this.gl.getShaderInfoLog(shader);
|
|
994
978
|
}
|
|
995
979
|
/**
|
|
996
980
|
* ```
|
|
@@ -1000,8 +984,7 @@ export class WebGlContextWrapper {
|
|
|
1000
984
|
* @returns
|
|
1001
985
|
*/
|
|
1002
986
|
createProgram() {
|
|
1003
|
-
|
|
1004
|
-
return gl.createProgram();
|
|
987
|
+
return this.gl.createProgram();
|
|
1005
988
|
}
|
|
1006
989
|
/**
|
|
1007
990
|
* ```
|
|
@@ -1013,8 +996,7 @@ export class WebGlContextWrapper {
|
|
|
1013
996
|
* @returns
|
|
1014
997
|
*/
|
|
1015
998
|
getProgramParameter(program, pname) {
|
|
1016
|
-
|
|
1017
|
-
return gl.getProgramParameter(program, pname);
|
|
999
|
+
return this.gl.getProgramParameter(program, pname);
|
|
1018
1000
|
}
|
|
1019
1001
|
/**
|
|
1020
1002
|
* ```
|
|
@@ -1025,8 +1007,7 @@ export class WebGlContextWrapper {
|
|
|
1025
1007
|
* @returns
|
|
1026
1008
|
*/
|
|
1027
1009
|
getProgramInfoLog(program) {
|
|
1028
|
-
|
|
1029
|
-
return gl.getProgramInfoLog(program);
|
|
1010
|
+
return this.gl.getProgramInfoLog(program);
|
|
1030
1011
|
}
|
|
1031
1012
|
/**
|
|
1032
1013
|
* ```
|
|
@@ -1037,8 +1018,7 @@ export class WebGlContextWrapper {
|
|
|
1037
1018
|
* @param source
|
|
1038
1019
|
*/
|
|
1039
1020
|
shaderSource(shader, source) {
|
|
1040
|
-
|
|
1041
|
-
gl.shaderSource(shader, source);
|
|
1021
|
+
this.gl.shaderSource(shader, source);
|
|
1042
1022
|
}
|
|
1043
1023
|
/**
|
|
1044
1024
|
* ```
|
|
@@ -1048,8 +1028,34 @@ export class WebGlContextWrapper {
|
|
|
1048
1028
|
* @param shader
|
|
1049
1029
|
*/
|
|
1050
1030
|
deleteShader(shader) {
|
|
1031
|
+
this.gl.deleteShader(shader);
|
|
1032
|
+
}
|
|
1033
|
+
/**
|
|
1034
|
+
* ```
|
|
1035
|
+
* gl.deleteBuffer(buffer);
|
|
1036
|
+
* ```
|
|
1037
|
+
*
|
|
1038
|
+
* @param buffer - The buffer to delete
|
|
1039
|
+
*/
|
|
1040
|
+
deleteBuffer(buffer) {
|
|
1051
1041
|
const { gl } = this;
|
|
1052
|
-
gl.
|
|
1042
|
+
gl.deleteBuffer(buffer);
|
|
1043
|
+
// Reset bound buffers if they match the deleted buffer
|
|
1044
|
+
if (this.boundArrayBuffer === buffer) {
|
|
1045
|
+
this.boundArrayBuffer = null;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* ```
|
|
1050
|
+
* gl.deleteVertexArray(vertexArray);
|
|
1051
|
+
* ```
|
|
1052
|
+
*
|
|
1053
|
+
* @param vertexArray - The vertex array object to delete
|
|
1054
|
+
*/
|
|
1055
|
+
deleteVertexArray(vertexArray) {
|
|
1056
|
+
if (this.isWebGl2()) {
|
|
1057
|
+
this.gl.deleteVertexArray(vertexArray);
|
|
1058
|
+
}
|
|
1053
1059
|
}
|
|
1054
1060
|
/**
|
|
1055
1061
|
* Check for WebGL errors and return error information
|