Page 1 of 1

Re: TextSceneNode display problem when splitted view

Posted: Fri May 11, 2018 10:28 am
by CuteAlien
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().

Code: Select all

 
        // set to full viewport
        driver->setViewPort(rect<s32>(0,0,ResX,ResY));
        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);