Mixing XNA and silverlight gives wierd graphics
Posted
by
Mech0z
on Game Development
See other posts from Game Development
or by Mech0z
Published on 2012-04-07T17:42:44Z
Indexed on
2012/04/07
17:48 UTC
Read the original article
Hit count: 405
I making a small 3dgame which is made as a Silverlight and XNA app, but when I draw the sprites the graphics becomes all wierd.
All my primitive types are rendered correctly, but my 3d models are just wierd
My Draw is like this when silverlight is set to draw
private void OnDraw(object sender, GameTimerEventArgs e)
{
// Render the Silverlight controls using the UIElementRenderer
elementRenderer.Render();
// Clear the screen to a solid color
SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.CornflowerBlue);
switch (gameState)
{
case GameState.ChooseStarter:
TextBlockStatus.Text = "Find Starting Player";
break;
case GameState.PlaceBrick:
TextBlockPlayer.Text = (playerTurn == PlayerTurn.PlayerOne) ? "Player One" : "Player Two";
TextBlockState.Text = "Place Brick";
foreach (IGraphicObject obj in _3dObjects)
{
obj.Draw(cameraPosition, e);
}
break;
case GameState.GiveBrick:
TextBlockState.Text = "Give Brick";
break;
}
spriteBatch.Begin();
// Using the texture from the UIElementRenderer,
// draw the Silverlight controls to the screen
spriteBatch.Draw(elementRenderer.Texture, cameraProjection, Color.White);
spriteBatch.End();
}
This gives me this output
If I comment the spritebatch lines out I get the correct output, except the silverlight text is of course not shown
I am not entirely sure what to look for except that zero vector I am giving to the spritebatch, but if thats the source I have no idea what I am supposed to set it as epspecially when its a 2d vector
© Game Development or respective owner