Advertisement
Guest User

quick example

a guest
Aug 26th, 2011
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.44 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Microsoft.Xna.Framework;
  5. using Microsoft.Xna.Framework.Content;
  6. using Microsoft.Xna.Framework.Graphics;
  7.  
  8. namespace WindowsGame1
  9. {
  10.     public class Game1 : Microsoft.Xna.Framework.Game
  11.     {
  12.         GraphicsDeviceManager graphics;
  13.         SpriteBatch spriteBatch;
  14.  
  15.         RenderTarget2D MyRenderTarget;
  16.  
  17.         public Game1()
  18.         {
  19.             graphics = new GraphicsDeviceManager(this);
  20.             Content.RootDirectory = "Content";
  21.         }
  22.  
  23.         protected override void Initialize()
  24.         {
  25.             base.Initialize();
  26.             MyRenderTarget = new RenderTarget2D(GraphicsDevice, 100, 100);
  27.         }
  28.         protected override void LoadContent()
  29.         {
  30.             spriteBatch = new SpriteBatch(GraphicsDevice);
  31.         }
  32.  
  33.         protected override void UnloadContent()
  34.         {
  35.         }
  36.  
  37.         protected override void Update(GameTime gameTime)
  38.         {
  39.             base.Update(gameTime);
  40.         }
  41.  
  42.         protected override void Draw(GameTime gameTime)
  43.         {
  44.  
  45.             GraphicsDevice.SetRenderTarget(MyRenderTarget);
  46.  
  47.             // draw the first shader pass with your textures here, like normal using spritebatch.
  48.  
  49.             GraphicsDevice.SetRenderTarget(null);
  50.  
  51.             //Draw the second pass here, using MyRenderTarget as the source texture.
  52.  
  53.             base.Draw(gameTime);
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement