Change render target to 16bit
This commit is contained in:
11
src/main.ts
11
src/main.ts
@@ -24,10 +24,11 @@ function initGL(canvas: HTMLCanvasElement) {
|
||||
alert("Unable to initialize WebGL. Your browser or machine may not support it.");
|
||||
}
|
||||
gl = <WebGL2RenderingContext>gltemp;
|
||||
//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
|
||||
|
||||
//WebGL2 supports floating point textures by default but it does not support filtering them or rendering to them by default. Note: 16bit filtering is included
|
||||
if (!gl.getExtension('EXT_color_buffer_float')) {
|
||||
console.log("32Bit render Buffers not available.")
|
||||
} //allow 32bit texture as framebuffer target
|
||||
|
||||
gl.enable(gl.DEPTH_TEST);
|
||||
}
|
||||
|
||||
@@ -220,7 +221,7 @@ function initFBO() {
|
||||
// Add attachments
|
||||
textureFBO = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, textureFBO); //last 3 parameter not intertesting becuase we are not supplying data
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA32F, perlinNoiseFBOWidth, ferlinNoiseFBOHeight, 0, gl.RGBA, gl.FLOAT, null);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.R16F, perlinNoiseFBOWidth, ferlinNoiseFBOHeight, 0, gl.RED, gl.HALF_FLOAT, null);
|
||||
|
||||
// set the filtering so we don't need mips
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
|
||||
Reference in New Issue
Block a user