|
@@ -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;
|
|
@@ -480,7 +480,7 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
|
|
|
if ( blending === NoBlending ) {
|
|
|
|
|
|
- if ( currentBlendingEnabled ) {
|
|
|
+ if ( currentBlendingEnabled === true ) {
|
|
|
|
|
|
disable( gl.BLEND );
|
|
|
currentBlendingEnabled = false;
|
|
@@ -491,7 +491,7 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( ! currentBlendingEnabled ) {
|
|
|
+ if ( currentBlendingEnabled === false ) {
|
|
|
|
|
|
enable( gl.BLEND );
|
|
|
currentBlendingEnabled = true;
|
|
@@ -877,6 +877,38 @@ 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;
|
|
@@ -884,7 +916,7 @@ function WebGLState( gl, extensions, capabilities ) {
|
|
|
|
|
|
currentProgram = null;
|
|
|
|
|
|
- currentBlendingEnabled = null;
|
|
|
+ currentBlendingEnabled = false;
|
|
|
currentBlending = null;
|
|
|
currentBlendEquation = null;
|
|
|
currentBlendSrc = null;
|