 	import tetragon.view.render2d.events.Event2D;
 	import tetragon.view.render2d.textures.Texture2D;
 
-	import com.hexagonstar.exception.AbstractClassException;
 	import com.hexagonstar.exception.MissingContext3DException;
 	import com.hexagonstar.util.geom.MatrixUtil;
 	import com.hexagonstar.util.geom.RectangleUtil;


				var passTexture:Texture2D = getPassTexture(i);

				context.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, mMvpConstantID, support.mvpMatrix3D, true);
				context.setTextureAt(mBaseTextureID, passTexture.base);

				activate(i, context, passTexture);
				context.drawTriangles(mIndexBuffer, 0, 2);
				deactivate(i, context, passTexture);
			}

			// reset shader attributes
			context.setVertexBufferAt(mVertexPosAtID, null);
			context.setVertexBufferAt(mTexCoordsAtID, null);
			context.setTextureAt(mBaseTextureID, null);

			support.popMatrix();


				// the bounds are a rectangle around the object, in stage coordinates,
				// and with an optional margin. To fit into a POT-texture, it will grow towards
				// the right and bottom.
				var deltaMargin:Number = _resolution == 1.0 ? 0.0 : 1.0 / _resolution;
				// avoid hard edges
				resultRect.x -= _marginX + deltaMargin;
				resultRect.y -= _marginY + deltaMargin;
				resultRect.width += 2 * (_marginX + deltaMargin);
				resultRect.height += 2 * (_marginY + deltaMargin);
				resultRect.width = nextPowerOfTwo(resultRect.width * _resolution) / _resolution;
				resultRect.height = nextPowerOfTwo(resultRect.height * _resolution) / _resolution;
			}
		}


		private function disposePassTextures():void
		{
			for each (var texture:Texture2D in _passTextures)
				texture.dispose();

			_passTextures = null;
		}


		private function disposeCache():void
		{
			if (_cache)
			{
				if (_cache.texture) _cache.texture.dispose();
				_cache.dispose();
				_cache = null;
			}
		}

