public override void Draw(RenderContext renderContext, GameTime gameTime) { if (renderContext.layerPass != RenderContext.LayerPass.UI_PASS) { return; } var basicEffect = new BasicEffect(renderContext.graphicsDevice); camera.ApplyMatrices(basicEffect); var basicEffect3 = new BasicEffect(renderContext.graphicsDevice); basicEffect3.Projection = Matrix.CreateOrthographicOffCenter(0, renderContext.graphicsDevice.Viewport.Width, renderContext.graphicsDevice.Viewport.Height, 0, 1, 1000); List <VertexPosition> markerVertices = new List <VertexPosition>(); Vector3 v = Vector3Helper.UnitSphere(longitude * Mathf.PI / 180, latitude * Mathf.PI / 180); v = camera.Project(renderContext.graphicsDevice, v); if (v.Z < 1) { float z = -10; markerVertices.Add(new VertexPosition(new Vector3(v.X - HALF_SIZE, v.Y + HALF_SIZE, z))); markerVertices.Add(new VertexPosition(new Vector3(v.X - HALF_SIZE, v.Y - HALF_SIZE, z))); markerVertices.Add(new VertexPosition(new Vector3(v.X + HALF_SIZE, v.Y + HALF_SIZE, z))); markerVertices.Add(new VertexPosition(new Vector3(v.X + HALF_SIZE, v.Y - HALF_SIZE, z))); foreach (EffectPass pass in basicEffect3.CurrentTechnique.Passes) { pass.Apply(); renderContext.graphicsDevice.DrawUserPrimitives <VertexPosition>(PrimitiveType.TriangleStrip, markerVertices.ToArray()); } } // city text Vector2 measured = GlobalContent.Arial.MeasureString(name); // apparently was setting the depthstencialstate to null and it would never get reset // this caused me so much confusion! spriteBatch.Begin(SpriteSortMode.Deferred, null, null, DepthStencilState.Default, null, null, null); spriteBatch.DrawString(GlobalContent.Arial, name, new Vector2(v.X + HALF_SIZE * 1.5f, v.Y - measured.Y / 2), Color.White); spriteBatch.End(); }