diff --git a/src/main.ts b/src/main.ts index 2331f02..48ebbc6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -24,7 +24,10 @@ function initGL(canvas: HTMLCanvasElement) { alert("Unable to initialize WebGL. Your browser or machine may not support it."); } gl = gltemp; - gl.getExtension( 'EXT_color_buffer_float' ); + //WebGL2 supports floating point textures by default but it does not support filtering them or rendering to them by default. + gl.getExtension( 'EXT_color_buffer_float' ); //allow 32bit texture as framebuffer target + gl.getExtension( 'OES_texture_float_linear' ); //allow linear filtering + gl.enable(gl.DEPTH_TEST); } @@ -220,8 +223,8 @@ function initFBO() { gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA32F, perlinNoiseFBOWidth, ferlinNoiseFBOHeight, 0, gl.RGBA, gl.FLOAT, null); // set the filtering so we don't need mips - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);