3D Text

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
minas1
Posts: 35
Joined: Mon May 17, 2010 11:19 am

3D Text

Post by minas1 »

Is there a way to draw 3D text? Not 2D text in 3D space, 3D text.

I hope there is a function like that because I don't want to make 3D models of all letters in the alphabet...
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

As far as I know, no you can't do that natively with irrlicht, but I'm sure you could find a usable 3D alphabet online somewhere, and if not, creating 3D letters shouldn't be too hard (just somewhat time consuming)

It should be possible to automate the process of creating 3D models of letters though
minas1
Posts: 35
Joined: Mon May 17, 2010 11:19 am

Post by minas1 »

Radikalizm wrote:As far as I know, no you can't do that natively with irrlicht, but I'm sure you could find a usable 3D alphabet online somewhere, and if not, creating 3D letters shouldn't be too hard (just somewhat time consuming)

It should be possible to automate the process of creating 3D models of letters though
Hello, thank you for your reply. I think I might use the function D3DXCreateText that creates 3D text.

But it requires the Direct3D Device. Do you know how can I get it?
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Post by Radikalizm »

IVideoDriver::getExposedVideoData() will give you a pointer to the native D3D device

http://irrlicht.sourceforge.net/docu/cl ... 745e50cc49
minas1
Posts: 35
Joined: Mon May 17, 2010 11:19 am

Post by minas1 »

Thank you very much!
minas1
Posts: 35
Joined: Mon May 17, 2010 11:19 am

Post by minas1 »

I used the tutorial on this page:

And that's my code, after I have set everything up + the device to direct3D9.

http://www.drunkenhyena.com/cgi-bin/vie ... article=20

Code: Select all

// ... more code unnecessary
// TEST
	HDC hdc;
	HFONT win32font;

   hdc=CreateCompatibleDC(NULL);

   win32font=CreateFont(10,         //Height
                   0,          //Width
                   0,          //Escapement
                   0,          //Orientation
                   FW_NORMAL,  //Weight
                   false,      //Italic
                   false,      //Underline
                   false,      //Strikeout
                   ANSI_CHARSET,//Charset 
                   OUT_DEFAULT_PRECIS,  //Output Precision
                   CLIP_DEFAULT_PRECIS, //Clipping Precision
                   DEFAULT_QUALITY,     //Quality
                   DEFAULT_PITCH|FF_DONTCARE, //Pitch and Family
                   L"Arial");

	SelectObject(hdc, win32font);

	ID3DXMesh *mesh_ = NULL;
	HWND activeWindow = GetActiveWindow();
	HDC p_dc = GetDC(activeWindow);

	LPDIRECT3DDEVICE9 g_d3d_device = driver->getExposedVideoData().D3D9.D3DDev9;

	HRESULT hr=D3DXCreateText(g_d3d_device,  //Device
                     p_dc,          //GDI Device Context
                     L"Hello World", //Text 
                     0.001f,        //Maximum chordal deviation from true font outlines       
                     0.4f,          //Extrusion depth (along -Z axis)
                     &mesh_,         //Mesh
                     NULL,          //Adjacency information
                     NULL);         //GlyphMetrics
However it's not working. The return value of D3DXCreateText is D3DERR_INVALIDCALL. I have tested all other things if they are null, like hdc, d3d device etc.
Post Reply