Prechádzať zdrojové kódy

fixed clear() when depth/color mask was enabled

Nicolas Cannasse 10 rokov pred
rodič
commit
f20a3eaefb
1 zmenil súbory, kde vykonal 5 pridanie a 0 odobranie
  1. 5 0
      h3d/impl/GlDriver.hx

+ 5 - 0
h3d/impl/GlDriver.hx

@@ -324,14 +324,19 @@ class GlDriver extends Driver {
 	override function clear( ?color : h3d.Vector, ?depth : Float, ?stencil : Int ) {
 		var bits = 0;
 		if( color != null ) {
+			gl.colorMask(true, true, true, true);
+			if( curMatBits >= 0 ) curMatBits |= Pass.colorMask_mask;
 			gl.clearColor(color.r, color.g, color.b, color.a);
 			bits |= GL.COLOR_BUFFER_BIT;
 		}
 		if( depth != null ) {
+			gl.depthMask(true);
+			if( curMatBits >= 0 ) curMatBits |= Pass.depthWrite_mask;
 			gl.clearDepth(depth);
 			bits |= GL.DEPTH_BUFFER_BIT;
 		}
 		if( stencil != null ) {
+			// reset stencyl mask when we allow to change it
 			gl.clearStencil(stencil);
 			bits |= GL.STENCIL_BUFFER_BIT;
 		}