Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async draw() {
if (this.isDrawing) {
// if another draw call is already running, we need to skip this one
return;
}
this.isDrawing = true;
const gl = await glPromise;
gl.uniform1f(contrastLocation, this.state.contrast);
gl.drawArrays(gl.TRIANGLES, 0, 6);
gl.endFrameEXP();
// we need to use flip option because framebuffer contents are flipped vertically
const snapshot = await GLView.takeSnapshotAsync(gl, {
flip: true,
});
// delete previous snapshot
if (this.state.snapshot) {
FileSystem.deleteAsync(this.state.snapshot.uri as string, { idempotent: true });
}
this.setState({ snapshot });
this.isDrawing = false;
}