|
179 | 179 | this._mask_layer_le = mask_layer | mask_layer_l; |
180 | 180 |
|
181 | 181 | this._currentStencilEnabled = gl.isEnabled(gl.STENCIL_TEST); |
182 | | - this._currentStencilWriteMask = gl.getParameter(gl.STENCIL_WRITEMASK); |
183 | | - this._currentStencilFunc = gl.getParameter(gl.STENCIL_FUNC); |
184 | | - this._currentStencilRef = gl.getParameter(gl.STENCIL_REF); |
185 | | - this._currentStencilValueMask = gl.getParameter(gl.STENCIL_VALUE_MASK); |
186 | | - this._currentStencilFail = gl.getParameter(gl.STENCIL_FAIL); |
187 | | - this._currentStencilPassDepthFail = gl.getParameter(gl.STENCIL_PASS_DEPTH_FAIL); |
188 | | - this._currentStencilPassDepthPass = gl.getParameter(gl.STENCIL_PASS_DEPTH_PASS); |
| 182 | + this._currentStencilWriteMask = cc.glGetParameter(gl.STENCIL_WRITEMASK); |
| 183 | + this._currentStencilFunc = cc.glGetParameter(gl.STENCIL_FUNC); |
| 184 | + this._currentStencilRef = cc.glGetParameter(gl.STENCIL_REF); |
| 185 | + this._currentStencilValueMask = cc.glGetParameter(gl.STENCIL_VALUE_MASK); |
| 186 | + this._currentStencilFail = cc.glGetParameter(gl.STENCIL_FAIL); |
| 187 | + this._currentStencilPassDepthFail = cc.glGetParameter(gl.STENCIL_PASS_DEPTH_FAIL); |
| 188 | + this._currentStencilPassDepthPass = cc.glGetParameter(gl.STENCIL_PASS_DEPTH_PASS); |
189 | 189 |
|
190 | 190 | // enable stencil use |
191 | 191 | gl.enable(gl.STENCIL_TEST); |
192 | | - gl.stencilMask(mask_layer); |
193 | | - this._currentDepthWriteMask = gl.getParameter(gl.DEPTH_WRITEMASK); |
| 192 | + cc.glStencilMask(mask_layer); |
| 193 | + this._currentDepthWriteMask = cc.glGetParameter(gl.DEPTH_WRITEMASK); |
194 | 194 |
|
195 | | - gl.depthMask(false); |
| 195 | + cc.glDepthMask(false); |
196 | 196 |
|
197 | | - gl.stencilFunc(gl.NEVER, mask_layer, mask_layer); |
198 | | - gl.stencilOp(!node.inverted ? gl.ZERO : gl.REPLACE, gl.KEEP, gl.KEEP); |
| 197 | + cc.glStencilFunc(gl.NEVER, mask_layer, mask_layer); |
| 198 | + cc.glStencilOp(!node.inverted ? gl.ZERO : gl.REPLACE, gl.KEEP, gl.KEEP); |
199 | 199 |
|
200 | 200 | this._drawFullScreenQuadClearStencil(); |
201 | 201 |
|
202 | | - gl.stencilFunc(gl.NEVER, mask_layer, mask_layer); |
203 | | - gl.stencilOp(!node.inverted ? gl.REPLACE : gl.ZERO, gl.KEEP, gl.KEEP); |
| 202 | + cc.glStencilFunc(gl.NEVER, mask_layer, mask_layer); |
| 203 | + cc.glStencilOp(!node.inverted ? gl.REPLACE : gl.ZERO, gl.KEEP, gl.KEEP); |
204 | 204 |
|
205 | 205 | if (node.alphaThreshold < 1) { //TODO desktop |
206 | 206 | var program = cc.shaderCache.programForKey(cc.SHADER_POSITION_TEXTURECOLORALPHATEST); |
|
213 | 213 | }; |
214 | 214 |
|
215 | 215 | proto._onAfterDrawStencil = function(){ |
216 | | - gl.depthMask(this._currentDepthWriteMask); |
| 216 | + cc.glDepthMask(this._currentDepthWriteMask); |
217 | 217 |
|
218 | | - gl.stencilFunc(gl.EQUAL, this._mask_layer_le, this._mask_layer_le); |
219 | | - gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP); |
| 218 | + cc.glStencilFunc(gl.EQUAL, this._mask_layer_le, this._mask_layer_le); |
| 219 | + cc.glStencilOp(gl.KEEP, gl.KEEP, gl.KEEP); |
220 | 220 | }; |
221 | 221 |
|
222 | 222 | proto._onAfterVisit = function(){ |
223 | | - gl.stencilFunc(this._currentStencilFunc, this._currentStencilRef, this._currentStencilValueMask); |
224 | | - gl.stencilOp(this._currentStencilFail, this._currentStencilPassDepthFail, this._currentStencilPassDepthPass); |
225 | | - gl.stencilMask(this._currentStencilWriteMask); |
| 223 | + cc.glStencilFunc(this._currentStencilFunc, this._currentStencilRef, this._currentStencilValueMask); |
| 224 | + cc.glStencilOp(this._currentStencilFail, this._currentStencilPassDepthFail, this._currentStencilPassDepthPass); |
| 225 | + cc.glStencilMask(this._currentStencilWriteMask); |
226 | 226 | if (!this._currentStencilEnabled) |
227 | 227 | gl.disable(gl.STENCIL_TEST); |
228 | 228 |
|
|
0 commit comments