MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / setImage

Method setImage

src/tools/texture-lab/renderer.js:261–279  ·  view source on GitHub ↗
(image)

Source from the content-addressed store, hash-verified

259 }
260
261 setImage(image) {
262 if (this.textures.source) {
263 this.gl.deleteTexture(this.textures.source);
264 this.textures.source = null;
265 }
266 if (image) {
267 this.textures.source = this._createTexture(image);
268 this.imageWidth = image.width || image.videoWidth;
269 this.imageHeight = image.height || image.videoHeight;
270 } else {
271 this.imageWidth = 0;
272 this.imageHeight = 0;
273 const gl = this.gl;
274 gl.bindFramebuffer(gl.FRAMEBUFFER, null);
275 gl.viewport(0, 0, this.canvas.width, this.canvas.height);
276 gl.clearColor(0, 0, 0, 0);
277 gl.clear(gl.COLOR_BUFFER_BIT);
278 }
279 }
280
281 updateVideoFrame(video) {
282 if (!this.textures.source || !video) return;

Callers

nothing calls this directly

Calls 2

_createTextureMethod · 0.95
clearMethod · 0.45

Tested by

no test coverage detected