- swapped values of PreferredBackBufferWidth and PreferredBackBufferHeight (issue #464)
- more work on RenderTargets. The green rectangle is now rendering in RenderTarget sample (feature #463)
This commit is contained in:
parent
0d196c2f53
commit
5ddd0955b4
@ -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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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(); }
|
||||
}
|
||||
|
@ -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<Texture2D>(@"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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user