Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 36 additions & 4 deletions src/renderers/webgl/WebGLState.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function WebGLState( gl, extensions, capabilities ) {

let currentProgram = null;

let currentBlendingEnabled = null;
let currentBlendingEnabled = false;
let currentBlending = null;
let currentBlendEquation = null;
let currentBlendSrc = null;
Expand Down Expand Up @@ -480,7 +480,7 @@ function WebGLState( gl, extensions, capabilities ) {

if ( blending === NoBlending ) {

if ( currentBlendingEnabled ) {
if ( currentBlendingEnabled === true ) {

disable( gl.BLEND );
currentBlendingEnabled = false;
Expand All @@ -491,7 +491,7 @@ function WebGLState( gl, extensions, capabilities ) {

}

if ( ! currentBlendingEnabled ) {
if ( currentBlendingEnabled === false ) {

enable( gl.BLEND );
currentBlendingEnabled = true;
Expand Down Expand Up @@ -877,14 +877,46 @@ function WebGLState( gl, extensions, capabilities ) {

function reset() {

// reset state

gl.disable( gl.BLEND );
gl.disable( gl.CULL_FACE );
gl.disable( gl.DEPTH_TEST );
gl.disable( gl.POLYGON_OFFSET_FILL );
gl.disable( gl.SCISSOR_TEST );
gl.disable( gl.STENCIL_TEST );

gl.blendEquation( gl.FUNC_ADD );
gl.blendFunc( gl.ONE, gl.ZERO );
gl.blendFuncSeparate( gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );

gl.colorMask( true, true, true, true );
gl.clearColor( 0, 0, 0, 0 );

gl.depthMask( true );
gl.depthFunc( gl.LESS );
gl.clearDepth( 1 );

gl.stencilMask( 0xffffffff );
gl.stencilFunc( gl.ALWAYS, 0, 1 );
gl.stencilOp( gl.KEEP, gl.KEEP, gl.KEEP );
gl.clearStencil( 0 );

gl.cullFace( gl.BACK );
gl.frontFace( gl.CCW );

gl.polygonOffset( 0, 0 );

// reset internals

enabledCapabilities = {};

currentTextureSlot = null;
currentBoundTextures = {};

currentProgram = null;

currentBlendingEnabled = null;
currentBlendingEnabled = false;
currentBlending = null;
currentBlendEquation = null;
currentBlendSrc = null;
Expand Down