Skip to content

Commit

Permalink
WebGLBackground: Make sure buffers are writable before clear.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 committed May 20, 2024
1 parent 6be05e4 commit 4420079
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1533,12 +1533,6 @@ class WebGLRenderer {

_this.toneMapping = currentToneMapping;

// buffers might not be writable after rendering transmission which is required to ensure a correct clear

state.buffers.depth.setTest( true );
state.buffers.depth.setMask( true );
state.buffers.color.setMask( true );

}

function renderObjects( renderList, scene, camera ) {
Expand Down
6 changes: 6 additions & 0 deletions src/renderers/webgl/WebGLBackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,

if ( renderer.autoClear || forceClear ) {

// buffers might not be writable which is required to ensure a correct clear

state.buffers.depth.setTest( true );
state.buffers.depth.setMask( true );
state.buffers.color.setMask( true );

renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );

}
Expand Down

0 comments on commit 4420079

Please sign in to comment.