- 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)
|
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height)
|
||||||
: base(graphicsDevice)
|
: base(graphicsDevice)
|
||||||
{
|
{
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
|
||||||
|
base.levelCount = 1;
|
||||||
|
base.format = SurfaceFormat.Color;
|
||||||
|
|
||||||
this.depthStencilFormat = DepthFormat.None;
|
this.depthStencilFormat = DepthFormat.None;
|
||||||
this.multiSampleCount = 0;
|
this.multiSampleCount = 0;
|
||||||
this.usage = RenderTargetUsage.DiscardContents;
|
this.usage = RenderTargetUsage.DiscardContents;
|
||||||
|
@ -58,8 +58,8 @@ namespace ANX.Framework.Graphics
|
|||||||
public class Texture2D : Texture, IGraphicsResource
|
public class Texture2D : Texture, IGraphicsResource
|
||||||
{
|
{
|
||||||
#region Private Members
|
#region Private Members
|
||||||
private int width;
|
protected internal int width;
|
||||||
private int height;
|
protected internal int height;
|
||||||
|
|
||||||
#endregion // Private Members
|
#endregion // Private Members
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ namespace ANX.Framework
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.backBufferHeight;
|
return this.backBufferWidth;
|
||||||
}
|
}
|
||||||
set { throw new NotImplementedException(); }
|
set { throw new NotImplementedException(); }
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ namespace ANX.Framework
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return this.backBufferWidth;
|
return this.backBufferHeight;
|
||||||
}
|
}
|
||||||
set { throw new NotImplementedException(); }
|
set { throw new NotImplementedException(); }
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,13 @@ namespace RenderTarget
|
|||||||
GraphicsDeviceManager graphics;
|
GraphicsDeviceManager graphics;
|
||||||
SpriteBatch spriteBatch;
|
SpriteBatch spriteBatch;
|
||||||
|
|
||||||
|
Texture2D texture;
|
||||||
RenderTarget2D renderTarget;
|
RenderTarget2D renderTarget;
|
||||||
|
|
||||||
public Game1()
|
public Game1()
|
||||||
{
|
{
|
||||||
graphics = new GraphicsDeviceManager(this);
|
graphics = new GraphicsDeviceManager(this);
|
||||||
Content.RootDirectory = "Content";
|
Content.RootDirectory = "SampleContent";
|
||||||
|
|
||||||
this.Window.Title = "ANX.Framework - RenderTarget sample - you should see a green rectangle";
|
this.Window.Title = "ANX.Framework - RenderTarget sample - you should see a green rectangle";
|
||||||
}
|
}
|
||||||
@ -39,7 +40,9 @@ namespace RenderTarget
|
|||||||
{
|
{
|
||||||
spriteBatch = new SpriteBatch(GraphicsDevice);
|
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()
|
protected override void UnloadContent()
|
||||||
@ -68,7 +71,7 @@ namespace RenderTarget
|
|||||||
GraphicsDevice.Clear(Color.CornflowerBlue);
|
GraphicsDevice.Clear(Color.CornflowerBlue);
|
||||||
|
|
||||||
spriteBatch.Begin();
|
spriteBatch.Begin();
|
||||||
spriteBatch.Draw(this.renderTarget, new Vector2(64, 64), Color.White);
|
spriteBatch.Draw(this.renderTarget, new Vector2(50, 50), Color.White);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
base.Draw(gameTime);
|
base.Draw(gameTime);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user