Ok i haven’t done any shader stuff with spritebatch in monogame so i basically wanted to give it a shot. I used yesterdays build, created a default fx using the pipeline tool, added a image and a sprite font, dropped in the basic code i thought used to work in 4.0 but, Im getting nothing drawing. The background is cleared but text and image disappear…
What am i missing here ?
` public class Game1 : Game
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
protected override void Initialize()
protected override void LoadContent()
spriteBatch = new SpriteBatch(GraphicsDevice);
myfont = Content.Load<SpriteFont>("MyFont");
myeffect = Content.Load<Effect>("MyEffects");
tpic01 = Content.Load<Texture2D>("tpic01");
protected override void UnloadContent()
protected override void Update(GameTime gameTime)
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
protected override void Draw(GameTime gameTime)
// drop in my effect and text and image disappear.
spriteBatch.Begin(0, BlendState.NonPremultiplied, null, null, null, myeffect);
spriteBatch.Draw(tpic01, new Rectangle(100, 100, 300, 300), Color.White);
spriteBatch.DrawString(myfont, "hello", new Vector2(20, 20), Color.AntiqueWhite);
, the basic stuff the pipeline tool outputs for a fx file it shouldn’t change anything
Edit: lol never mind doh, i just realized why there is a effect and spriteeffect option in the pipeline tool menu i thought that was some sort of bug didn’t realize one was for spriteBatch and the other for 3d drawing.
Ya i do want to be able to alter the vertices using the shader, Ill give what you posted below a shot.
This is the one for spritebatch has the sampler state set up.
This won’t work because the matrix you pass in spriteBatch.Begin is applied in the vertex shader of SpriteEffect. Since you use your own vertex shader, this doesn’t do anything. Instead you should set the matrix in your effect so it does what the SpriteEffect vertex shader normally does.