Results 1 to 4 of 4

Thread: DirectX 3D text cant change size

  1. #1

    DirectX 3D text cant change size

    Hello

    Code:
      hdc := CreateCompatibleDC(0);
    
    
       hfont:=CreateFont(12,         //Height
                       0,          //Width
                       0,          //Escapement
                       0,          //Orientation
                       FW_NORMAL,  //Weight
                       0,      //Italic
                       0,      //Underline
                       0,      //Strikeout
                       DEFAULT_CHARSET,//Charset
                       OUT_DEFAULT_PRECIS,  //Output Precision
                       CLIP_DEFAULT_PRECIS, //Clipping Precision
                       DEFAULT_QUALITY,     //Quality
                       DEFAULT_PITCH or FF_DONTCARE, //Pitch and Family
                       'Arial');
    
    
      hFontOld := SelectObject(hdc, hFont);
    
      D3DXCreateText(Direct3DDevice, hDC, PChar(Text), Deviation, Extrusion, Mesh, nil, nil);
    
      SelectObject(hdc, hFontOld);
      DeleteObject(hFont);
      DeleteDC(hdc);
    see the comment line "height" using this value to change the size of my 3D text but cant works, the size still the same... only using a matrix transformation i can chnage the size... dont have other way?

    Greetings
    Knowledge is power.

  2. #2

    DirectX 3D text cant change size

    No, i'm afraid that is not possible.... :?

    what you do here is, create a font and generate a mesh from it. Once the mesh is created you cannot change any font related parameters because it is a MESH object and you can only do MESH-related things with it.

    But what's wrong with a transformation matrix?? It is THE way of rendering geometry with different translation/rotation/size :razz:

    P.S: if you just want 2D text, i advice you not to use D3DXCreateText, because that would be overkill and way to slow. You could use ID3DXFont for 2D or you could make a font format of your own. The latter requires the following steps:

    > Create a texture with all the charachters on it, and also a file which contains all the rectangles wich enclose the different rectangles... (You can easily do this by using font-studio made by Nitrogen)

    > Load this data into your engine... Create the texture in video memory
    > When rendering... fill a vertexbuffer with quads (for each letter a quad).
    A quad is a set of two rectangles which show an character rectangle to the user.
    > Render the vertexbuffer

    Hope this helps
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

  3. #3

    DirectX 3D text cant change size

    Quote Originally Posted by chronozphere
    No, i'm afraid that is not possible.... :?

    what you do here is, create a font and generate a mesh from it. Once the mesh is created you cannot change any font related parameters because it is a MESH object and you can only do MESH-related things with it.

    But what's wrong with a transformation matrix?? It is THE way of rendering geometry with different translation/rotation/size :razz:

    P.S: if you just want 2D text, i advice you not to use D3DXCreateText, because that would be overkill and way to slow. You could use ID3DXFont for 2D or you could make a font format of your own. The latter requires the following steps:

    > Create a texture with all the charachters on it, and also a file which contains all the rectangles wich enclose the different rectangles... (You can easily do this by using font-studio made by Nitrogen)

    > Load this data into your engine... Create the texture in video memory
    > When rendering... fill a vertexbuffer with quads (for each letter a quad).
    A quad is a set of two rectangles which show an character rectangle to the user.
    > Render the vertexbuffer

    Hope this helps
    ok thanks nathan!...
    Knowledge is power.

  4. #4

    DirectX 3D text cant change size

    No problem
    Coders rule nr 1: Face ur bugz.. dont cage them with code, kill'em with ur cursor.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •