2012-09-22 63 views
1

我在XNA 4.0 3D中繪製字符串時遇到問題。我已知的問題是spriteBatch.Begin()。但我不知道如何解決它。在XNA 4.0 3D中繪製字符串和紋理?

protected override void Draw(GameTime gameTime) 
{ 
    GraphicsDevice.Clear(Color.DeepSkyBlue); 
    //Draw string 
    spriteBatch.Begin(); 
    spriteBatch.DrawString(fontArial, "Demotesting", new Vector2(100, 100), Color.Red); 
    spriteBatch.End(); 
    //Draw Models Ship 
    ship.Draw(); 

    base.Draw(gameTime); 
} 

拉繩前: http://nq1.upanh.com/b4.s32.d1/6c6ce19bded8d054341ce45e17426c51_49358001.before.png

後拉繩: http://nq2.upanh.com/b6.s30.d2/9ff7c3c009215348b06a53c5a067d282_49358002.after.png

+1

你的問題是什麼? –

回答

2

將這個在你的上面畫法:

GraphicsDevice.BlendState = BlendState.AlphaBlend; 
GraphicsDevice.DepthStencilState = DepthStencilState.Default; 

,並應解決這個問題。

+0

謝謝你的回答,我很成功在3D中繪製文本2D – HaiTrieu

+0

@ user1690759習慣上接受解決問題的答案。這就是stackoverflow的工作原理! – neeKo

0

的精靈批渣土一些渲染設置身邊,你需要谷歌四處打聽什麼設置,我首先啓用深度緩衝區。