Skip to main content
these are not needed, i guess
Source Link
EnoughTea
  • 2.6k
  • 16
  • 16

Since you override SpriteBatch's default effect with your own, you are now responsible for setting effect parameters, especially matrices. You probably would like to replicate default SpriteBatch behaviour, so set effect.World to identity, and for projection default SpriteBatch effect uses effect.Projection = Matrix.CreateTranslation(-0.5f, -0.5f, 0) * Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1);

Also do not forget to set TextureEnabled to true, maybe you will need VertexColorEnabled as well.

Since you override SpriteBatch's default effect with your own, you are now responsible for setting effect parameters, especially matrices. You probably would like to replicate default SpriteBatch behaviour, so set effect.World to identity, and for projection default SpriteBatch effect uses effect.Projection = Matrix.CreateTranslation(-0.5f, -0.5f, 0) * Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1);

Also do not forget to set TextureEnabled to true, maybe you will need VertexColorEnabled as well.

Since you override SpriteBatch's default effect with your own, you are now responsible for setting effect parameters, especially matrices. You probably would like to replicate default SpriteBatch behaviour, so set effect.World to identity, and for projection default SpriteBatch effect uses effect.Projection = Matrix.CreateTranslation(-0.5f, -0.5f, 0) * Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1);

Source Link
EnoughTea
  • 2.6k
  • 16
  • 16

Since you override SpriteBatch's default effect with your own, you are now responsible for setting effect parameters, especially matrices. You probably would like to replicate default SpriteBatch behaviour, so set effect.World to identity, and for projection default SpriteBatch effect uses effect.Projection = Matrix.CreateTranslation(-0.5f, -0.5f, 0) * Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0, 1);

Also do not forget to set TextureEnabled to true, maybe you will need VertexColorEnabled as well.