mono/MonoGame — Issue #347: RenderTarget - Matrix not applied
Author: degborta
Created: 2012-03-02 08:22:00+00:00
State: open

When using a RenderTarget and calling spriteBatch.Begin() with a matrix to handle rotation, the matrix is not applied, it is drawn without rotation.

Have tested this on iOS and Windows, but the problem seems to be only on iOS.

protected override void Draw (GameTime gameTime)
{
GraphicsDevice.Clear (Color.CornflowerBlue);

Rectangle bound1 = new Rectangle (0, 0, width, height);

GraphicsDevice.SetRenderTarget (render);
GraphicsDevice.Clear (Color.CornflowerBlue);

spriteBatch.Begin (SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Matrix.CreateRotationZ ((float)gameTime.TotalGameTime.TotalSeconds * 4));
spriteBatch.Draw (debug, bound1, new Color (1, 0, 0, 0.5f));
spriteBatch.End ();

GraphicsDevice.SetRenderTarget (null);
GraphicsDevice.Clear (Color.CornflowerBlue);
Texture2D final = (Texture2D)render;

spriteBatch.Begin ();
spriteBatch.Draw (final, bound1, Color.White);
spriteBatch.End ();

base.Draw (gameTime);
}