(gl, filterMode, width, height)
| 105 | |
| 106 | // Returns a wrapper class with a framebuffer and output texture for it. |
| 107 | function createTextureFrameBuffer(gl, filterMode, width, height) { |
| 108 | const framebuffer = gl.createFramebuffer(); |
| 109 | gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer); |
| 110 | |
| 111 | const texture = createWebGLTexture( |
| 112 | gl, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, filterMode, null, width, |
| 113 | height); |
| 114 | checkGlError(gl, 'TextureFramebuffer::Create: create texture'); |
| 115 | |
| 116 | gl.framebufferTexture2D( |
| 117 | gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0); |
| 118 | const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER); |
| 119 | |
| 120 | if (status != gl.FRAMEBUFFER_COMPLETE) { |
| 121 | throw new Error(`Bad framebuffer status:${status}`); |
| 122 | } |
| 123 | |
| 124 | return new GlTextureFramebuffer(gl, framebuffer, texture, width, height); |
| 125 | } |
| 126 | |
| 127 | // Returns a wrapper class with a texture and its util. |
| 128 | function createTexture(gl, texture, width, height) { |
no test coverage detected