How to create a simple 3D Text

Hi,

i want to create a simple 3D Text displaying "Hello World" on the window with DircetX.

I did not found a simple example in the docs so I hope someone can help me here.

Thanks in advance.

 



Answer this question

How to create a simple 3D Text

  • tedeum

    In the Managed DirectX 1.1 assemblies you will find a method associated with the mesh class called Mesh.TextFromFont method which will create a mesh from the specified font. I am sure this is what you are looking for.

    I hope this helps.
    Take care.


  • Jezza101

    Hi zman,

    i know this sample, however, it contains too much of information i don't need.

    I only need to know how what' s necessary to create simple line of 3D text without messing around with other stuff that comes with this sample.

    Thanks again.


  • Amitsriva

    There is a sample called Text3D in the sample browser for both managed and native DirectX

  • RKaplan

    Hi,

    thanks, but i use native DirectX with C++.

    In the WinAPI there is a function called drawText which draws a text in the client window area.

    What i am looking for is a similar function within DirectX SDK.

    If anyone has a bit of code or a tutorial on this that would be very great.


  • forum389

    Hi zman,

    ok. Looks like there is a bit more to do when displaying text.<

    Thanks for the tutorial link. This was rearly helpful.

    I am a beginner on text3D issues, so excuse me nagging.

    Regards


  • Muthu Krishnan. R

    There is no simple single call to do this. You need to create a 3d mesh from the font and then position it using transformations like any other mesh then draw it.

    I'm not sure what you think is too much information in the sample. You can ignore all of the things in the common directory and just look in the Demonstration4 in OnFrameRender and the call to CreateD3DXTextMesh in OnResetDevice...

    Drunken Hyena also has a tutorial http://www.drunkenhyena.com/cgi-bin/view_cpp_article.pl chapter=3;article=20 as does Chad http://www.c-unit.com/tutorials/directx/ t=13



  • madura

    Hi,

    I had the same problem. Below, you can see a sample of my code. Maybe you can find it useful.

    PS. It is written in VB.Net. I hope you will have no problems to translate it into VC++.

    dim FontFormat = New Microsoft.DirectX.Direct3D.FontDescription

    With FontFormat

    .FaceName = "Arial"

    .Height = 14

    .OutputPrecision = Precision.Default

    .PitchAndFamily = PitchAndFamily.DefaultPitch

    .Quality = FontQuality.Default

    .Weight = FontWeight.Normal

    End With

    dim FontDX = New Microsoft.DirectX.Direct3D.Font(MyDX3DDevice, FontFormat)

    FontDX.DrawText(Nothing, "Hello World!", _

    New System.Drawing.Rectangle(1, 1, 100,200), _

    Microsoft.DirectX.Direct3D.DrawTextFormat.Center, System.Drawing.Color.White)

    Regards,

    Karlo


  • How to create a simple 3D Text