How to draw the text with vertical orientation?

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
hankersyan
Posts: 7
Joined: Sun Dec 13, 2009 1:54 am

How to draw the text with vertical orientation?

Post by hankersyan »

Like this, i want to draw text from bottom to top, or from top to bottom.
thanks!
Image[/img]
Escen
Competition winner
Posts: 167
Joined: Sun Jul 19, 2009 11:27 am
Location: the Netherlands
Contact:

Post by Escen »

I'm not sure you want to apply this in 2D or 3D but maybe you can render your text to a texture (RTT), then place this texture on a rotated quad.
Look at the render to texture example.

Also I found this wonderful topic. The forum search is great...
Recently I needed many text rotations and used OpenGl wglUseFontOutlines direct, some options available here.

Cheers
Escen
hankersyan
Posts: 7
Joined: Sun Dec 13, 2009 1:54 am

Post by hankersyan »

Thank you, Escen. You really give me a great help.
And Sudi's CTextNode can work. but its looking is not so good. I guess that the camera's zoom does result in.
Image
Escen
Competition winner
Posts: 167
Joined: Sun Jul 19, 2009 11:27 am
Location: the Netherlands
Contact:

Post by Escen »

Try some other bigger fonts

Code: Select all

        gui::IGUIFont* font = guienv->getFont("myfont.xml");

            if (font != 0)
            {
                guienv->getSkin()->setFont(font, gui::EGDF_DEFAULT);
            }
There is a really cool font tool at this topic
Escen
Competition winner
Posts: 167
Joined: Sun Jul 19, 2009 11:27 am
Location: the Netherlands
Contact:

Post by Escen »

OOPS... could not stop myself

Image

Code: Select all

#include <irrlicht.h>
#include "CTextNode.h"

using namespace irr;


using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;


#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif


int main()
{
IrrlichtDevice *device;
  SIrrlichtCreationParameters deviceParameter;
        deviceParameter.DriverType = EDT_OPENGL;
        deviceParameter.AntiAlias = EAAM_QUALITY;
        deviceParameter.Bits = 32;
        deviceParameter.Fullscreen = false;
        deviceParameter.Stencilbuffer=false;
        deviceParameter.Vsync = false;
        deviceParameter.WindowSize = dimension2d<s32>(400,800);
        device = createDeviceEx(deviceParameter);

	if (!device)
		return 1;


	device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");


	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();
	IGUIEnvironment* guienv = device->getGUIEnvironment();


        gui::IGUIFont* font = guienv->getFont("myfont.xml");

            if (font != 0)
            {
                guienv->getSkin()->setFont(font, gui::EGDF_DEFAULT);

            }

	smgr->addCameraSceneNodeFPS();

    CTextNode* text = new CTextNode(guienv, smgr->getRootSceneNode(), smgr);
    text->setText("TEXT");
    text->setPosition(irr::core::vector3df(0,20,0));
    text->setRotation(irr::core::vector3df(0,0,90));

	while(device->run())
	{

		driver->beginScene(true, true, SColor(255,100,101,140));

		smgr->drawAll();
		guienv->drawAll();

		driver->endScene();
	}


	device->drop();

	return 0;
}
hankersyan
Posts: 7
Joined: Sun Dec 13, 2009 1:54 am

Post by hankersyan »

:D
Thank you, again, Escen. It is what i want.
Post Reply