Add WebGL compatibility

This commit is contained in:
schmelczerandras 2020-09-22 16:41:59 +02:00
parent 3725f56c78
commit 1d4980ae28
29 changed files with 567 additions and 212 deletions

View file

@ -1,4 +1,5 @@
import { vec2 } from 'gl-matrix';
import { UniversalRenderingContext } from '../universal-rendering-context';
export abstract class FrameBuffer {
public renderScale = 1;
@ -9,7 +10,7 @@ export abstract class FrameBuffer {
// null means the default framebuffer
protected frameBuffer: WebGLFramebuffer | null = null;
constructor(protected gl: WebGL2RenderingContext) {}
constructor(protected gl: UniversalRenderingContext) {}
public bindAndClear(colorInput?: WebGLTexture) {
this.gl.bindFramebuffer(this.gl.FRAMEBUFFER, this.frameBuffer);