PDA

View Full Version : DirectX 3D text cant change size



lordzero
03-10-2007, 02:49 AM
Hello




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

chronozphere
03-10-2007, 02:23 PM
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 :)

lordzero
03-10-2007, 03:35 PM
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!... :)

chronozphere
03-10-2007, 05:03 PM
No problem ;)