private void TestRendering() { renderer = new RenderTargetRenderer(Camera.Main); renderer.PerformRender(this.ContentManagerName, "MainCameraTexture"); ImageData imageData = ImageData.FromTexture2D(renderer.Texture); // verify that colors are what they should be: if(imageData.GetPixelColor(1,1).R != 255) { throw new Exception("Control case failed - top-left pixel is not red"); } var pixelColor = imageData.GetPixelColor (1, 11); if(pixelColor.R == 255) { throw new Exception("Transparency from PNGs is not rendering correctly"); } if (imageData.GetPixelColor(SolidColorTransparencyTestSprite.Texture.Width + 1, 11).R == 255) { throw new Exception("Transparency from Sprite Alpha is not rendering correctly"); } }
public RenderableLayer(string contentManagerName, string thisName) { mContentManagerName = contentManagerName; mName = thisName; mRenderer = new RenderTargetRenderer(Camera.Main.DestinationRectangle.Width, Camera.Main.DestinationRectangle.Height); TargetLayer = new Layer(); TargetLayer.UsePixelCoordinates(); mSprite = new Sprite(); mSprite.TextureScale = 1; SpriteManager.AddToLayer(mSprite, TargetLayer); mSprite.AttachTo(Camera.Main, false); mSprite.RelativeX = 0; mSprite.RelativeY = 0; mSprite.RelativeZ = -40; }
public RenderableLayer (string contentManagerName, string thisName) { mContentManagerName = contentManagerName; mName = thisName; mRenderer = new RenderTargetRenderer(Camera.Main.DestinationRectangle.Width, Camera.Main.DestinationRectangle.Height); TargetLayer = new Layer(); TargetLayer.UsePixelCoordinates(); mSprite = new Sprite(); mSprite.TextureScale = 1; SpriteManager.AddToLayer(mSprite, TargetLayer); mSprite.AttachTo(Camera.Main, false); mSprite.RelativeX = 0; mSprite.RelativeY = 0; mSprite.RelativeZ = -40; }