diff --git a/ANX.Framework/Graphics/RenderTarget2D.cs b/ANX.Framework/Graphics/RenderTarget2D.cs index aa001ab4..d377f595 100644 --- a/ANX.Framework/Graphics/RenderTarget2D.cs +++ b/ANX.Framework/Graphics/RenderTarget2D.cs @@ -75,6 +75,12 @@ namespace ANX.Framework.Graphics public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height) : base(graphicsDevice) { + this.width = width; + this.height = height; + + base.levelCount = 1; + base.format = SurfaceFormat.Color; + this.depthStencilFormat = DepthFormat.None; this.multiSampleCount = 0; this.usage = RenderTargetUsage.DiscardContents; diff --git a/ANX.Framework/Graphics/Texture2D.cs b/ANX.Framework/Graphics/Texture2D.cs index a60e12b0..d1ea2933 100644 --- a/ANX.Framework/Graphics/Texture2D.cs +++ b/ANX.Framework/Graphics/Texture2D.cs @@ -58,8 +58,8 @@ namespace ANX.Framework.Graphics public class Texture2D : Texture, IGraphicsResource { #region Private Members - private int width; - private int height; + protected internal int width; + protected internal int height; #endregion // Private Members diff --git a/ANX.Framework/GraphicsDeviceManager.cs b/ANX.Framework/GraphicsDeviceManager.cs index ff536cc3..c48a8d45 100644 --- a/ANX.Framework/GraphicsDeviceManager.cs +++ b/ANX.Framework/GraphicsDeviceManager.cs @@ -306,7 +306,7 @@ namespace ANX.Framework { get { - return this.backBufferHeight; + return this.backBufferWidth; } set { throw new NotImplementedException(); } } @@ -315,7 +315,7 @@ namespace ANX.Framework { get { - return this.backBufferWidth; + return this.backBufferHeight; } set { throw new NotImplementedException(); } } diff --git a/Samples/RenderTarget/Game1.cs b/Samples/RenderTarget/Game1.cs index 67a811ce..120e321d 100644 --- a/Samples/RenderTarget/Game1.cs +++ b/Samples/RenderTarget/Game1.cs @@ -18,12 +18,13 @@ namespace RenderTarget GraphicsDeviceManager graphics; SpriteBatch spriteBatch; + Texture2D texture; RenderTarget2D renderTarget; public Game1() { graphics = new GraphicsDeviceManager(this); - Content.RootDirectory = "Content"; + Content.RootDirectory = "SampleContent"; this.Window.Title = "ANX.Framework - RenderTarget sample - you should see a green rectangle"; } @@ -39,7 +40,9 @@ namespace RenderTarget { spriteBatch = new SpriteBatch(GraphicsDevice); - this.renderTarget = new RenderTarget2D(GraphicsDevice, 128, 128); //, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8); + this.renderTarget = new RenderTarget2D(GraphicsDevice, graphics.PreferredBackBufferWidth - 100, graphics.PreferredBackBufferHeight - 100); //, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8); + + this.texture = Content.Load(@"Textures/ANX.logo"); } protected override void UnloadContent() @@ -68,7 +71,7 @@ namespace RenderTarget GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); - spriteBatch.Draw(this.renderTarget, new Vector2(64, 64), Color.White); + spriteBatch.Draw(this.renderTarget, new Vector2(50, 50), Color.White); spriteBatch.End(); base.Draw(gameTime);