TextSceneNode display problem when splitted view

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.

Re: TextSceneNode display problem when splitted view

Postby CuteAlien » Fri May 11, 2018 10:28 am

Problem is that text-output is GUI. And gui always should be with full viewport. The textscenenode basically does get a 3d-position and then calls drawText for that. In this case it won't work - you have to do it yourself. I can only give you some quick code for doing that for the moving camera in the Irrlicht example (18.SplitScreen).

Add before the endScene().
cpp Code: Select all
        // set to full viewport
        irr::scene::ISceneCollisionManager* Coll = device->getSceneManager()->getSceneCollisionManager();
        core::position2di textPos = Coll->getScreenCoordinatesFrom3DPosition(textPos3d, camera[3]);
        // now reverting the viewport calculation for camera 3
        textPos.X *= 0.5f; 
        textPos.Y *= 0.5f;
        textPos.X += ResX/2;
        textPos.Y += ResY/2;
        core::rect<s32> r(textPos, core::dimension2d<s32>(1,1));
        Font->draw(L"some text", r, video::SColor(255,255,255,255), true, true);
IRC: #irrlicht on irc.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
Posts: 8533
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Return to Beginners Help

Who is online

Users browsing this forum: No registered users and 0 guests