 										  actionOnBothPass				: String = 'keep', 
 										  actionOnDepthFail				: String = 'keep', 
 										  actionOnDepthPassStencilFail	: String = 'keep') : Context3DResource
-		{			
-			_context.setStencilActions( 
-				triangleFace,
-				compareMode,
-				actionOnBothPass,
-				actionOnDepthFail,
-				actionOnDepthPassStencilFail
-			);			
+		{
+            if (triangleFace != _stencilTriangleFace
+                || compareMode != _stencilCompareMode
+                || actionOnBothPass != _stencilActionOnBothPass
+                || actionOnDepthFail != _stencilActionOnDepthFail
+                || actionOnDepthPassStencilFail != _stencilActionOnDepthPassStencilFail
+            )
+            {
+    			_context.setStencilActions( 
+    				triangleFace,
+    				compareMode,
+    				actionOnBothPass,
+    				actionOnDepthFail,
+    				actionOnDepthPassStencilFail
+    			);
+                
+                _stencilTriangleFace = triangleFace;
+                _stencilCompareMode = compareMode;
+                _stencilActionOnBothPass = actionOnBothPass;
+                _stencilActionOnDepthFail = actionOnDepthFail;
+                _stencilActionOnDepthPassStencilFail = actionOnDepthPassStencilFail;
+            }
 
 			return this;
 		}

		public function Context3DResource(context : Context3D)
		{
			_context = context;
		}
		
		public function clear(red		: Number	= 0.0,
							  green		: Number	= 0.0,

												 readMask	: uint 	= 255,
												 writeMask	: uint 	= 255) : Context3DResource			
		{
            if (refNum != _stencilRefNum
                || readMask != _stencilReadMask
                || writeMask != _stencilWriteMask
                )
            {
                _context.setStencilReferenceValue(refNum, readMask, writeMask);
                
                _stencilRefNum = refNum;
                _stencilReadMask = readMask;
                _stencilWriteMask = writeMask;
            }
			
			return this;
		}
