HyApp
HyApp

Reputation: 1

Xna game rendering differently in wp 7.1 device and 7.1 emulator

Has anyone faced inconsistent behaviour when rendering a wp 7.1 xna game on a wp 7.1 device vs. wp 7.1 emulator? The game renders correctly on the device, but on the emulator the result turns out to have a purple hue on it. Also, taking a screenshot of the game on the device with RenderTarget2D.SaveAsJpeg produces the same incorrect result as the emulator.

The code is lengthy and messy but basically I'm trying to render a multitextured 2d terrain with simply SpriteBatch.Draw and some Texture2D's and RenderTarget2D's, as follows:

foreach TerrainLayer layer
{
    GraphicsDevice.SetRenderTarget(layer.RenderTarget2D) (SurfaceFormat.Color)
    GraphicsDevice.Clear(Color.Black)

    spriteBatch.Begin(args1)
    spriteBatch.Draw(layer.Texture2D) (dxt1)
    spriteBatch.End()

    spriteBatch.Begin(args2)
    spriteBatch.Draw(layer.alphamap) (SurfaceFormat.Color)
    spriteBatch.End()
}

GraphicsDevice.SetRenderTarget(renderedTerrain) (SurfaceFormat.Bgr565)
spriteBatch.Begin(alphablend)
foreach TerrainLayer layer
{
    spriteBatch.Draw(layer.RenderTarget2D)
}
spriteBatch.End()

GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(Color.Black);

//then draw to the final scene with
//graphics.PreferredBackBufferFormat = SurfaceFormat.Bgr565;
sb.Begin()
draw renderedTerrain, alphablend
sb.End();    

Update: To clarify the problem, this is what is seen on the device: Correct result

and this is what is both shown in the emulator and result of SaveAsJpeg on the device: Incorrect result

Upvotes: 0

Views: 66

Answers (1)

user1306322
user1306322

Reputation: 8721

This is to be expected with emulators of any kind. Best test the app in natural environment − either on the device or in desktop version, but the same screen resolution as your device.

Post some screenshots of what exactly is incorrect, along with the expected screenshots, if you can. Also, you're trying to solve several different problems in one question. Post separate questions for each problem.

Upvotes: 0

Related Questions