create() public static method

helper for creating a full screen RenderTarget2D
public static create ( ) : RenderTarget2D
return Microsoft.Xna.Framework.Graphics.RenderTarget2D
示例#1
0
 /// <summary>
 /// helper for creating a RenderTarget2D
 /// </summary>
 /// <param name="width">Width.</param>
 /// <param name="height">Height.</param>
 public RenderTexture(int width, int height)
 {
     renderTarget = RenderTarget.create(
         width,
         height,
         Screen.backBufferFormat,
         Screen.preferredDepthStencilFormat);
 }
示例#2
0
 /// <summary>
 /// helper for creating a full screen RenderTarget2D with a specific DepthFormat
 /// </summary>
 /// <param name="preferredDepthFormat">Preferred depth format.</param>
 public RenderTexture(DepthFormat preferredDepthFormat)
 {
     renderTarget = RenderTarget.create(
         Screen.width,
         Screen.height,
         Screen.backBufferFormat,
         preferredDepthFormat);
 }
示例#3
0
        /// <summary>
        /// resizes the RenderTarget2D to the specified size
        /// </summary>
        /// <param name="width">Width.</param>
        /// <param name="height">Height.</param>
        public void resize(int width, int height)
        {
            // no need to resize if we are already the right size
            if (renderTarget.Width == width && renderTarget.Height == height && !renderTarget.IsDisposed)
            {
                return;
            }

            // retain the same DepthFormat when we recreate the RenderTarget2D
            var depthFormat = renderTarget.DepthStencilFormat;

            // unload if necessary
            Dispose();

            renderTarget = RenderTarget.create(width, height, depthFormat);
        }
示例#4
0
 /// <summary>
 /// helper for creating a full screen RenderTarget2D
 /// </summary>
 public RenderTexture()
 {
     renderTarget = RenderTarget.create(Screen.backBufferWidth, Screen.backBufferHeight, Screen.backBufferFormat, Screen.preferredDepthStencilFormat);
 }