Skip to content

Instantly share code, notes, and snippets.

@gmjosack
Created July 13, 2011 07:31
Show Gist options
  • Save gmjosack/1079883 to your computer and use it in GitHub Desktop.
Save gmjosack/1079883 to your computer and use it in GitHub Desktop.
Minimum 2D HLSL Pixel Shader
namespace NewShader
{
public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Texture2D texture;
Effect effect;
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
}
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
texture = Content.Load<Texture2D>("surge");
effect = Content.Load<Effect>("Effect1");
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
effect.CurrentTechnique.Passes[0].Apply();
spriteBatch.Draw(texture, new Vector2(0, 0), Color.White);
spriteBatch.End();
base.Draw(gameTime);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment