m***@bmtmis.demon.co.uk
2008-02-15 11:50:05 UTC
Hi,
Can anyone help me out with this problem please?
Using Visual Studio 2005, Using Latest DirectX SDK (Novemeber 2007).
Have solid cube rendered on screen fine. Cube is centred at origin and
has side length of 2 units. I want to put text on the screen saying
"(1,1,1)" located at the position of that vertex.
No problem:
*******************************************************************
Vector3 vector = new Vector3(1.0f, 1.0f, 1.0f);
vector.Project(m_device.Viewport,
m_device.Transform.Projection, m_device.Transform.View,
m_device.Transform.World);
TextFormatFlags flags = TextFormatFlags.Bottom |
TextFormatFlags.EndEllipsis;
TextRenderer.DrawText(e.Graphics, "(1,1,1)", this.Font,new
Rectangle((int)vector.X, (int)vector.Y, 40, 20), Color.White, flags);
*******************************************************************
But of course, text is always on top. So when (1,1,1) is hidden by
rest of cube, text is still visible.
Instead of using the GDI+ to draw the text, how can I get DirectX to
render the text. Lots of examples I've seen on the net say use
DrawText function etc. But in latest SDK DrawText function is not a
member of Device and I can see no text draing functions in the DirectX
or Dirext.Direct3D namespaces.
Thanks for any help,
Mitch.
Can anyone help me out with this problem please?
Using Visual Studio 2005, Using Latest DirectX SDK (Novemeber 2007).
Have solid cube rendered on screen fine. Cube is centred at origin and
has side length of 2 units. I want to put text on the screen saying
"(1,1,1)" located at the position of that vertex.
No problem:
*******************************************************************
Vector3 vector = new Vector3(1.0f, 1.0f, 1.0f);
vector.Project(m_device.Viewport,
m_device.Transform.Projection, m_device.Transform.View,
m_device.Transform.World);
TextFormatFlags flags = TextFormatFlags.Bottom |
TextFormatFlags.EndEllipsis;
TextRenderer.DrawText(e.Graphics, "(1,1,1)", this.Font,new
Rectangle((int)vector.X, (int)vector.Y, 40, 20), Color.White, flags);
*******************************************************************
But of course, text is always on top. So when (1,1,1) is hidden by
rest of cube, text is still visible.
Instead of using the GDI+ to draw the text, how can I get DirectX to
render the text. Lots of examples I've seen on the net say use
DrawText function etc. But in latest SDK DrawText function is not a
member of Device and I can see no text draing functions in the DirectX
or Dirext.Direct3D namespaces.
Thanks for any help,
Mitch.