static #fragmentShader: WebGLShader | null
static #positionBuffer: WebGLBuffer | null
static #uvBuffer: WebGLBuffer | null
- static #frameBuffer: WebGLFramebuffer | null
- static #renderBuffer: WebGLRenderbuffer | null
static #query: WebGLQuery | null
static #pixels: Uint8Array
// Vertex Positions, 2 triangles
this.#gl.vertexAttribPointer(1, 2, this.#gl.FLOAT, false, 0, 0)
this.#gl.enableVertexAttribArray(1)
- this.#frameBuffer = this.#gl.createFramebuffer()
- this.#gl.bindFramebuffer(this.#gl.FRAMEBUFFER, this.#frameBuffer)
- this.#renderBuffer = this.#gl.createRenderbuffer()
- this.#gl.bindRenderbuffer(this.#gl.RENDERBUFFER, this.#renderBuffer)
- this.#gl.renderbufferStorage(this.#gl.RENDERBUFFER, this.#gl.RGBA8, this.#gl.drawingBufferWidth, this.#gl.drawingBufferHeight)
- this.#gl.framebufferRenderbuffer(this.#gl.FRAMEBUFFER, this.#gl.COLOR_ATTACHMENT0, this.#gl.RENDERBUFFER, this.#renderBuffer)
- if (this.#gl.checkFramebufferStatus(this.#gl.FRAMEBUFFER) !== this.#gl.FRAMEBUFFER_COMPLETE) {
- throw new Error('Framebuffer is not complete')
- }
- // this.#gl.viewport(0, 0, 1, 1)
- // this.#pixels = new Uint8Array(4)
this.#pixels = new Uint8Array(this.#gl.drawingBufferWidth * this.#gl.drawingBufferHeight * 4)
this.#query = this.#gl.createQuery()
- if (this.#query == null) {
- throw new Error('Failed to create query')
- }
this.#work0Location = this.#gl.getUniformLocation(this.#program, 'u_work0')
this.#work1Location = this.#gl.getUniformLocation(this.#program, 'u_work1')