diff --git a/ANX.Framework/ANX.Framework.csproj b/ANX.Framework/ANX.Framework.csproj index b364cc71..df8e9c9c 100644 --- a/ANX.Framework/ANX.Framework.csproj +++ b/ANX.Framework/ANX.Framework.csproj @@ -429,6 +429,7 @@ + diff --git a/ANX.Framework/Graphics/GraphicsDevice.cs b/ANX.Framework/Graphics/GraphicsDevice.cs index 1af5e08f..5d3e6b8e 100644 --- a/ANX.Framework/Graphics/GraphicsDevice.cs +++ b/ANX.Framework/Graphics/GraphicsDevice.cs @@ -243,9 +243,16 @@ namespace ANX.Framework.Graphics #region SetRenderTarget public void SetRenderTarget(RenderTarget2D renderTarget) { - RenderTargetBinding[] renderTargetBindings = new RenderTargetBinding[] { new RenderTargetBinding(renderTarget) }; - this.currentRenderTargetBindings = renderTargetBindings; - nativeDevice.SetRenderTargets(renderTargetBindings); + if (renderTarget != null) + { + RenderTargetBinding[] renderTargetBindings = new RenderTargetBinding[] { new RenderTargetBinding(renderTarget) }; + this.currentRenderTargetBindings = renderTargetBindings; + nativeDevice.SetRenderTargets(renderTargetBindings); + } + else + { + nativeDevice.SetRenderTargets(null); + } } public void SetRenderTarget(RenderTargetCube renderTarget, CubeMapFace cubeMapFace) diff --git a/ANX.Framework/Graphics/RenderTarget2D.cs b/ANX.Framework/Graphics/RenderTarget2D.cs index 2c43429e..aa001ab4 100644 --- a/ANX.Framework/Graphics/RenderTarget2D.cs +++ b/ANX.Framework/Graphics/RenderTarget2D.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using ANX.Framework.NonXNA; using ANX.Framework.Graphics; +using ANX.Framework.NonXNA.RenderSystem; #endregion // Using Statements @@ -61,34 +62,69 @@ namespace ANX.Framework.Graphics { public event EventHandler ContentLost; + #region Private Members + private DepthFormat depthStencilFormat; + private int multiSampleCount; + private RenderTargetUsage usage; + private bool isContentLost; + private INativeRenderTarget2D nativeRenderTarget; + + #endregion // Private Members + + #region Constructors public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height) - : base(graphicsDevice, width, height) + : base(graphicsDevice) { - throw new NotImplementedException(); + this.depthStencilFormat = DepthFormat.None; + this.multiSampleCount = 0; + this.usage = RenderTargetUsage.DiscardContents; + + this.nativeRenderTarget = AddInSystemFactory.Instance.GetDefaultCreator().CreateRenderTarget(graphicsDevice, width, height, false, SurfaceFormat.Color, this.depthStencilFormat, this.multiSampleCount, this.usage); + base.nativeTexture = this.nativeRenderTarget as INativeTexture2D; } public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat) - : base(graphicsDevice, width, height) + : base(graphicsDevice) { - throw new NotImplementedException(); + this.depthStencilFormat = DepthFormat.None; + this.multiSampleCount = 0; + this.usage = RenderTargetUsage.DiscardContents; + + this.nativeRenderTarget = AddInSystemFactory.Instance.GetDefaultCreator().CreateRenderTarget(graphicsDevice, width, height, false, SurfaceFormat.Color, this.depthStencilFormat, this.multiSampleCount, this.usage); + base.nativeTexture = this.nativeRenderTarget as INativeTexture2D; } public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage) - : base(graphicsDevice, width, height) + : base(graphicsDevice) { - throw new NotImplementedException(); + this.depthStencilFormat = preferredDepthFormat; + this.multiSampleCount = preferredMultiSampleCount; + this.usage = usage; + + this.nativeRenderTarget = AddInSystemFactory.Instance.GetDefaultCreator().CreateRenderTarget(graphicsDevice, width, height, false, SurfaceFormat.Color, this.depthStencilFormat, this.multiSampleCount, this.usage); + base.nativeTexture = this.nativeRenderTarget as INativeTexture2D; } + #endregion // Constructors + protected virtual void Dispose(Boolean disposeManaged) { throw new NotImplementedException(); } + internal INativeRenderTarget2D NativeRenderTarget + { + get + { + return this.nativeRenderTarget; + } + } + public DepthFormat DepthStencilFormat { get { - throw new NotImplementedException(); + return this.depthStencilFormat; } } @@ -96,7 +132,7 @@ namespace ANX.Framework.Graphics { get { - throw new NotImplementedException(); + return this.isContentLost; } } @@ -104,7 +140,7 @@ namespace ANX.Framework.Graphics { get { - throw new NotImplementedException(); + return this.multiSampleCount; } } @@ -112,12 +148,18 @@ namespace ANX.Framework.Graphics { get { - throw new NotImplementedException(); + return this.usage; } } void IDynamicGraphicsResource.SetContentLost(bool isContentLost) { + this.isContentLost = isContentLost; + if (isContentLost) + { + raise_ContentLost(this, EventArgs.Empty); + } + throw new NotImplementedException(); } diff --git a/ANX.Framework/Graphics/Texture2D.cs b/ANX.Framework/Graphics/Texture2D.cs index 2f74cc3b..a60e12b0 100644 --- a/ANX.Framework/Graphics/Texture2D.cs +++ b/ANX.Framework/Graphics/Texture2D.cs @@ -63,6 +63,12 @@ namespace ANX.Framework.Graphics #endregion // Private Members + internal Texture2D(GraphicsDevice graphicsDevice) + : base(graphicsDevice) + { + + } + public Texture2D(GraphicsDevice graphicsDevice, int width, int height) : base(graphicsDevice) { @@ -72,7 +78,7 @@ namespace ANX.Framework.Graphics base.levelCount = 1; base.format = SurfaceFormat.Color; - CreateNativeTextureSurface(); + CreateNativeTextureSurface(graphicsDevice, SurfaceFormat.Color, width, height, levelCount); } public Texture2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat format) @@ -84,7 +90,7 @@ namespace ANX.Framework.Graphics base.levelCount = 1; //TODO: mipmap paramter?!?!? base.format = format; - CreateNativeTextureSurface(); + CreateNativeTextureSurface(graphicsDevice, format, width, height, levelCount); } public static Texture2D FromStream(GraphicsDevice graphicsDevice, Stream stream) @@ -171,9 +177,9 @@ namespace ANX.Framework.Graphics } } - private void CreateNativeTextureSurface() + internal void CreateNativeTextureSurface(GraphicsDevice device, SurfaceFormat format, int width, int height, int levelCount) { - base.nativeTexture = AddInSystemFactory.Instance.GetDefaultCreator().CreateTexture(GraphicsDevice, format, Width, Height, levelCount); + base.nativeTexture = AddInSystemFactory.Instance.GetDefaultCreator().CreateTexture(device, format, width, height, levelCount); } } } diff --git a/ANX.Framework/NonXNA/RenderSystem/INativeRenderTarget2D.cs b/ANX.Framework/NonXNA/RenderSystem/INativeRenderTarget2D.cs new file mode 100644 index 00000000..3a480c67 --- /dev/null +++ b/ANX.Framework/NonXNA/RenderSystem/INativeRenderTarget2D.cs @@ -0,0 +1,60 @@ +#region Using Statements +using System; +using ANX.Framework.Graphics; + +#endregion // Using Statements + +#region License + +// +// This file is part of the ANX.Framework created by the "ANX.Framework developer group". +// +// This file is released under the Ms-PL license. +// +// +// +// Microsoft Public License (Ms-PL) +// +// This license governs use of the accompanying software. If you use the software, you accept this license. +// If you do not accept the license, do not use the software. +// +// 1.Definitions +// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning +// here as under U.S. copyright law. +// A "contribution" is the original software, or any additions or changes to the software. +// A "contributor" is any person that distributes its contribution under this license. +// "Licensed patents" are a contributor's patent claims that read directly on its contribution. +// +// 2.Grant of Rights +// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations +// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to +// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution +// or any derivative works that you create. +// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in +// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed +// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution +// in the software or derivative works of the contribution in the software. +// +// 3.Conditions and Limitations +// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. +// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your +// patent license from such contributor to the software ends automatically. +// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution +// notices that are present in the software. +// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including +// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or +// object code form, you may only do so under a license that complies with this license. +// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, +// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the +// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a +// particular purpose and non-infringement. + +#endregion // License + +namespace ANX.Framework.NonXNA.RenderSystem +{ + public interface INativeRenderTarget2D + { + //INativeTexture2D NativeTexture { get; } + } +} diff --git a/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs b/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs index 42e792fb..733344af 100644 --- a/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs +++ b/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs @@ -65,6 +65,8 @@ namespace ANX.Framework INativeTexture2D CreateTexture(GraphicsDevice graphics, SurfaceFormat surfaceFormat, int width, int height, int mipCount); + INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage); + INativeBuffer CreateIndexBuffer(GraphicsDevice graphics, IndexElementSize size, int indexCount, BufferUsage usage); INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage); diff --git a/RenderSystems/ANX.Framework.Windows.DX10/ANX.Framework.Windows.DX10.csproj b/RenderSystems/ANX.Framework.Windows.DX10/ANX.Framework.Windows.DX10.csproj index 71de3536..098e4537 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/ANX.Framework.Windows.DX10.csproj +++ b/RenderSystems/ANX.Framework.Windows.DX10/ANX.Framework.Windows.DX10.csproj @@ -75,6 +75,7 @@ + diff --git a/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs b/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs index ad75b9e1..8ed9f044 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs +++ b/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs @@ -227,5 +227,10 @@ namespace ANX.Framework.Windows.DX10 { return new Texture2D_DX10(graphics, width, height, surfaceFormat, mipCount); } + + public INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage) + { + return new RenderTarget2D_DX10(graphics, width, height, mipMap, preferredFormat, preferredDepthFormat, preferredMultiSampleCount, usage); + } } } diff --git a/RenderSystems/ANX.Framework.Windows.DX10/GraphicsDeviceWindowsDX10.cs b/RenderSystems/ANX.Framework.Windows.DX10/GraphicsDeviceWindowsDX10.cs index 6dd9a494..5af02089 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/GraphicsDeviceWindowsDX10.cs +++ b/RenderSystems/ANX.Framework.Windows.DX10/GraphicsDeviceWindowsDX10.cs @@ -99,6 +99,7 @@ namespace ANX.Framework.Windows.DX10 private Device device; private SwapChain swapChain; private RenderTargetView renderView; + private RenderTargetView renderTargetView; private DepthStencilView depthStencilView; private SharpDX.Direct3D10.Texture2D backBuffer; internal Effect_DX10 currentEffect; @@ -159,7 +160,7 @@ namespace ANX.Framework.Windows.DX10 clearColor.Alpha = color.A * ColorMultiplier; } - this.device.ClearRenderTargetView(this.renderView, this.clearColor); + this.device.ClearRenderTargetView(this.renderTargetView != null ? this.renderTargetView : this.renderView, this.clearColor); } public void Clear(ClearOptions options, Vector4 color, float depth, int stencil) @@ -172,8 +173,9 @@ namespace ANX.Framework.Windows.DX10 this.clearColor.Green = color.Y; this.clearColor.Blue = color.Z; this.clearColor.Alpha = color.W; + this.lastClearColor = 0; - this.device.ClearRenderTargetView(this.renderView, this.clearColor); + this.device.ClearRenderTargetView(this.renderTargetView != null ? this.renderTargetView : this.renderView, this.clearColor); } if (this.depthStencilView != null) @@ -396,7 +398,40 @@ namespace ANX.Framework.Windows.DX10 public void SetRenderTargets(params RenderTargetBinding[] renderTargets) { - throw new NotImplementedException(); + if (renderTargets == null) + { + // reset the RenderTarget to backbuffer + if (renderTargetView != null) + { + renderTargetView.Dispose(); + renderTargetView = null; + } + + device.OutputMerger.SetRenderTargets(1, new RenderTargetView[] { this.renderView }, this.depthStencilView); + } + else + { + if (renderTargets.Length == 1) + { + RenderTarget2D renderTarget = renderTargets[0].RenderTarget as RenderTarget2D; + RenderTarget2D_DX10 nativeRenderTarget = renderTarget.NativeRenderTarget as RenderTarget2D_DX10; + if (renderTarget != null) + { + if (renderTargetView != null) + { + renderTargetView.Dispose(); + renderTargetView = null; + } + this.renderTargetView = new RenderTargetView(device, ((Texture2D_DX10)nativeRenderTarget).NativeShaderResourceView.Resource); + DepthStencilView depthStencilView = null; + device.OutputMerger.SetRenderTargets(1,new RenderTargetView[] { this.renderTargetView }, depthStencilView); + } + } + else + { + throw new NotImplementedException("handling of multiple RenderTargets are not yet implemented"); + } + } } @@ -473,7 +508,25 @@ namespace ANX.Framework.Windows.DX10 public void Dispose() { - //TODO: implement + if (renderTargetView != null) + { + renderTargetView.Dispose(); + renderTargetView = null; + } + + if (swapChain != null) + { + renderView.Dispose(); + renderView = null; + + backBuffer.Dispose(); + backBuffer = null; + + swapChain.Dispose(); + swapChain = null; + } + + //TODO: dispose everything else } } } diff --git a/RenderSystems/ANX.Framework.Windows.DX10/RenderTarget2D_DX10.cs b/RenderSystems/ANX.Framework.Windows.DX10/RenderTarget2D_DX10.cs new file mode 100644 index 00000000..b518dd4f --- /dev/null +++ b/RenderSystems/ANX.Framework.Windows.DX10/RenderTarget2D_DX10.cs @@ -0,0 +1,103 @@ +#region Using Statements +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using ANX.Framework.Graphics; +using ANX.Framework.NonXNA.RenderSystem; +using SharpDX.Direct3D10; + +#endregion // Using Statements + +#region License + +// +// This file is part of the ANX.Framework created by the "ANX.Framework developer group". +// +// This file is released under the Ms-PL license. +// +// +// +// Microsoft Public License (Ms-PL) +// +// This license governs use of the accompanying software. If you use the software, you accept this license. +// If you do not accept the license, do not use the software. +// +// 1.Definitions +// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning +// here as under U.S. copyright law. +// A "contribution" is the original software, or any additions or changes to the software. +// A "contributor" is any person that distributes its contribution under this license. +// "Licensed patents" are a contributor's patent claims that read directly on its contribution. +// +// 2.Grant of Rights +// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations +// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to +// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution +// or any derivative works that you create. +// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in +// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed +// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution +// in the software or derivative works of the contribution in the software. +// +// 3.Conditions and Limitations +// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. +// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your +// patent license from such contributor to the software ends automatically. +// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution +// notices that are present in the software. +// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including +// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or +// object code form, you may only do so under a license that complies with this license. +// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees, +// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the +// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a +// particular purpose and non-infringement. + +#endregion // License + +namespace ANX.Framework.Windows.DX10 +{ + public class RenderTarget2D_DX10 : Texture2D_DX10, INativeRenderTarget2D, INativeTexture2D + { + #region Private Members + + #endregion // Private Members + + public RenderTarget2D_DX10(GraphicsDevice graphics, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage) + : base(graphics) + { + if (mipMap) + { + throw new NotImplementedException("creating RenderTargets with mip map not yet implemented"); + } + + this.surfaceFormat = surfaceFormat; + + GraphicsDeviceWindowsDX10 graphicsDX10 = graphicsDevice.NativeDevice as GraphicsDeviceWindowsDX10; + SharpDX.Direct3D10.Device device = graphicsDX10.NativeDevice; + + SharpDX.Direct3D10.Texture2DDescription description = new SharpDX.Direct3D10.Texture2DDescription() + { + Width = width, + Height = height, + MipLevels = 1, + ArraySize = 1, + Format = FormatConverter.Translate(preferredFormat), + SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0), + Usage = SharpDX.Direct3D10.ResourceUsage.Default, + BindFlags = SharpDX.Direct3D10.BindFlags.ShaderResource | SharpDX.Direct3D10.BindFlags.RenderTarget, + CpuAccessFlags = SharpDX.Direct3D10.CpuAccessFlags.None, + OptionFlags = SharpDX.Direct3D10.ResourceOptionFlags.None, + }; + this.nativeTexture = new SharpDX.Direct3D10.Texture2D(graphicsDX10.NativeDevice, description); + this.nativeShaderResourceView = new SharpDX.Direct3D10.ShaderResourceView(graphicsDX10.NativeDevice, this.nativeTexture); + + // description of texture formats of DX10: http://msdn.microsoft.com/en-us/library/bb694531(v=VS.85).aspx + // more helpfull information on DX10 textures: http://msdn.microsoft.com/en-us/library/windows/desktop/bb205131(v=vs.85).aspx + + this.formatSize = FormatConverter.FormatSize(surfaceFormat); + } + + } +} diff --git a/RenderSystems/ANX.Framework.Windows.DX10/Texture2D_DX10.cs b/RenderSystems/ANX.Framework.Windows.DX10/Texture2D_DX10.cs index 2d2efa33..47dd0824 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/Texture2D_DX10.cs +++ b/RenderSystems/ANX.Framework.Windows.DX10/Texture2D_DX10.cs @@ -63,14 +63,19 @@ namespace ANX.Framework.Windows.DX10 public class Texture2D_DX10 : INativeTexture2D { #region Private Members - private SharpDX.Direct3D10.Texture2D nativeTexture; - private SharpDX.Direct3D10.ShaderResourceView nativeShaderResourceView; - private int formatSize; - private SurfaceFormat surfaceFormat; - private GraphicsDevice graphicsDevice; + protected internal SharpDX.Direct3D10.Texture2D nativeTexture; + protected internal SharpDX.Direct3D10.ShaderResourceView nativeShaderResourceView; + protected internal int formatSize; + protected internal SurfaceFormat surfaceFormat; + protected internal GraphicsDevice graphicsDevice; #endregion // Private Members + internal Texture2D_DX10(GraphicsDevice graphicsDevice) + { + this.graphicsDevice = graphicsDevice; + } + public Texture2D_DX10(GraphicsDevice graphicsDevice, int width, int height, SurfaceFormat surfaceFormat, int mipCount) { if (mipCount > 1) diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs b/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs index 69be93fd..b9daa4d5 100644 --- a/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs +++ b/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs @@ -302,5 +302,10 @@ namespace ANX.Framework.Windows.GL3 return new ReadOnlyCollection(result); } #endregion - } + + public INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage) + { + throw new NotImplementedException(); + } + } } diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs index 7992f203..170fc291 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs @@ -229,5 +229,11 @@ namespace ANX.RenderSystem.Windows.DX11 { throw new NotImplementedException(); } + + + public Framework.NonXNA.RenderSystem.INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage) + { + throw new NotImplementedException(); + } } } diff --git a/Samples/RenderTarget/Game1.cs b/Samples/RenderTarget/Game1.cs index 76bd7dad..67a811ce 100644 --- a/Samples/RenderTarget/Game1.cs +++ b/Samples/RenderTarget/Game1.cs @@ -2,18 +2,18 @@ using System; using System.Collections.Generic; using System.Linq; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.GamerServices; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; -using Microsoft.Xna.Framework.Media; +using ANX.Framework; +using ANX.Framework.Audio; +using ANX.Framework.Content; +using ANX.Framework.GamerServices; +using ANX.Framework.Graphics; +using ANX.Framework.Input; +using ANX.Framework.Media; #endregion namespace RenderTarget { - public class Game1 : Microsoft.Xna.Framework.Game + public class Game1 : ANX.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; @@ -24,6 +24,8 @@ namespace RenderTarget { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; + + this.Window.Title = "ANX.Framework - RenderTarget sample - you should see a green rectangle"; } protected override void Initialize() @@ -37,7 +39,7 @@ namespace RenderTarget { spriteBatch = new SpriteBatch(GraphicsDevice); - this.renderTarget = new RenderTarget2D(GraphicsDevice, 128, 128, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8); + this.renderTarget = new RenderTarget2D(GraphicsDevice, 128, 128); //, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8); } protected override void UnloadContent() @@ -60,6 +62,7 @@ namespace RenderTarget { GraphicsDevice.SetRenderTarget(this.renderTarget); GraphicsDevice.Clear(ClearOptions.Target, Color.Green, 1.0f, 0); + //GraphicsDevice.Clear(Color.Green); GraphicsDevice.SetRenderTarget(null); GraphicsDevice.Clear(Color.CornflowerBlue); diff --git a/Samples/RenderTarget/RenderTarget.csproj b/Samples/RenderTarget/RenderTarget.csproj index 10880cc0..5dd5b061 100644 --- a/Samples/RenderTarget/RenderTarget.csproj +++ b/Samples/RenderTarget/RenderTarget.csproj @@ -60,10 +60,6 @@ true - - - - @@ -83,6 +79,22 @@ + + {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35} + ANX.Framework + + + {60D08399-244F-46A3-91F1-4CFD26D961A3} + ANX.InputSystem.Windows.XInput + + + {5BE49183-2F6F-4527-AC90-D816911FCF90} + ANX.Framework.Windows.DX10 + + + {6A582788-C4D2-410C-96CD-177F75712D65} + ANX.SoundSystem.Windows.XAudio + {FA6E229D-4504-47B1-8A23-2D3FCC13F778} SampleContent