Browse Source

fix if statements in WebGLState

Alexander Rose 5 years ago
parent
commit
6a29925733
1 changed files with 14 additions and 12 deletions
  1. 14 12
      src/mol-gl/webgl/state.ts

+ 14 - 12
src/mol-gl/webgl/state.ts

@@ -114,20 +114,22 @@ export function createState(gl: GLRenderingContext): WebGLState {
             }
         },
         colorMask: (red: boolean, green: boolean, blue: boolean, alpha: boolean) => {
-            if (red !== currentColorMask[0] || green !== currentColorMask[1] || blue !== currentColorMask[2] || alpha !== currentColorMask[3])
-            gl.colorMask(red, green, blue, alpha)
-            currentColorMask[0] = red
-            currentColorMask[1] = green
-            currentColorMask[2] = blue
-            currentColorMask[3] = alpha
+            if (red !== currentColorMask[0] || green !== currentColorMask[1] || blue !== currentColorMask[2] || alpha !== currentColorMask[3]) {
+                gl.colorMask(red, green, blue, alpha)
+                currentColorMask[0] = red
+                currentColorMask[1] = green
+                currentColorMask[2] = blue
+                currentColorMask[3] = alpha
+            }
         },
         clearColor: (red: number, green: number, blue: number, alpha: number) => {
-            if (red !== currentClearColor[0] || green !== currentClearColor[1] || blue !== currentClearColor[2] || alpha !== currentClearColor[3])
-            gl.clearColor(red, green, blue, alpha)
-            currentClearColor[0] = red
-            currentClearColor[1] = green
-            currentClearColor[2] = blue
-            currentClearColor[3] = alpha
+            if (red !== currentClearColor[0] || green !== currentClearColor[1] || blue !== currentClearColor[2] || alpha !== currentClearColor[3]) {
+                gl.clearColor(red, green, blue, alpha)
+                currentClearColor[0] = red
+                currentClearColor[1] = green
+                currentClearColor[2] = blue
+                currentClearColor[3] = alpha
+            }
         },
 
         blendFunc: (src: number, dst: number) => {