baga

Hi, i have problem when using font in simple 3d scene, source code:

protected override void Draw(GameTime gameTime)

{

mGraphics.GraphicsDevice.Clear(Color.CornflowerBlue);

// draw car

transforms = new Matrix[mCar.Bones.Count];

mCar.CopyAbsoluteBoneTransformsTo(transforms);

Matrix carRot =

Matrix.CreateRotationX(mVehicle.DiffFb) *

Matrix.CreateRotationZ(mVehicle.DiffLr) *

Matrix.CreateRotationY(mCarRotation);

Matrix carPos = Matrix.CreateTranslation(mCarPosition);

Matrix carMat = carRot * carPos;

foreach (ModelMesh mesh in mCar.Meshes)

{

foreach (BasicEffect effect in mesh.Effects)

{

effect.EnableDefaultLighting();

effect.World = transforms[mesh.ParentBone.Index] * carMat;

effect.Projection = mProjectionMatrix;

effect.View = mViewMatrix;

}

mesh.Draw();

}

mRusFont.DrawString(0, 0, Color.White, "Hello world");

base.Draw(gameTime);

}

Problem: font is visible, but mesh looks like transparent or inverted, some parts invisible. Maybe before render font i need to switch from 3d to 2d mode



Re: XNA Framework Bitmap Font problem

Jim Perry

See Shawn's blog entry here.




Re: XNA Framework Bitmap Font problem

baga

Thanks, now program works correct!



Re: XNA Framework Bitmap Font problem

Jim Perry

Good to hear!