I'm trying to render an ITextSceneNode in a viewport that's smaller than the full resolution of the window.
When I render an ITextSceneNode without calling setViewPort, it works perfectly and renders where I expect it to. However, if I call setViewPort first, the text renders in an unexpected location. I am rendering a billboard as well, and that renders where I expect.
Anyone able to let me know what's going on here?
Here are some screenshots of what I'm getting.
Without the setViewPort call:
With the setViewPort call (I set the text to white because it shows up more clearly here; I would very much like the text to be in the white square):
The offending line is commented out in the following code.
Code: Select all
IBillboardSceneNode * bnode = smgr->addBillboardSceneNode(
0,dimension2d<f32>(32,32),core::vector3df(0,0,10));
bnode->setMaterialFlag(video::EMF_LIGHTING, false);
bnode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL);
bnode->setMaterialTexture(0, driver->getTexture("../media/textures/waypoint.png"));
smgr->addTextSceneNode(guienv->getBuiltInFont(),
L"TEST",
video::SColor(255,255,255,255), bnode);
smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
//driver->setViewPort(rect<s32>(0,0,640/2,480/2));
smgr->drawAll();
driver->endScene();
}