Page 1 of 1

[.NetCP] problem with changing addtextbillboardscene text

Posted: Sat Nov 15, 2008 3:05 pm
by Kairu
hi everyone

i have problem changing text in text billboard, as i change the text using

Code: Select all

 bill = smgr.AddBillboardTextSceneNode(font1, "yahoo", Nothing, New IrrlichtNETCP.Dimension2Df(2, 2), _
New IrrlichtNETCP.Vector3D(0, 0, 0), 2, New IrrlichtNETCP.Color(100, 100, 100, 100), _
New IrrlichtNETCP.Color(100, 100, 10, 0))

// this is how i change my text,
 bill.Text = "xxx"        this is similar with bill->setText = "xxx "  i suppose
//but if i put it in 'While device.Run' loop it will multiply itself as i rotate:? 
// and if i try put it somewhere else it will cover it with the new one without
//erasing the old one:? 


oh ya , i think i better explain what i' m trying to do
i want user to input coordinate (in number) and i show the number using billboard and based on the number i set the location. later on after some processing i need to show the modifier value of the coordinate as well as the new position

thanks alot especially to admins , JP and everyone

Posted: Sat Nov 15, 2008 5:33 pm
by Acki
it seems you're using .net, don't you ???
I think it's a problem with the .net lib...
so you should ask this in the .net forum... ;)

what I can say is that the following code work like a charm, but it's not .net though:

Code: Select all

#include <irrlicht.h>

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

int main(){
	IrrlichtDevice *device = createDevice(EDT_DIRECT3D9);
	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();
	IGUIEnvironment* guienv = device->getGUIEnvironment();

  ITextSceneNode* bill = smgr->addBillboardTextSceneNode(guienv->getBuiltInFont(),
                                                         L"yahoo",
                                                         0,
                                                         dimension2df(2, 2),
                                                         vector3df(0,0,0),
                                                         2,
                                                         SColor(100, 100, 100, 100),
                                                         SColor(100, 100, 10, 0));

  smgr->addCameraSceneNodeFPS(0,50,50);
	while(device->run()){
	  bill->setText(L"xxx");
		driver->beginScene(true, true, video::SColor(0,0,211,211));
		smgr->drawAll();
		guienv->drawAll();
		driver->endScene();
	}
	device->drop();
	return 0;
}
also a hint: don't set the text each render loop, just set it when the text has changed...
I also set the text here every render loop, but only to try to reproduce the error... ;)

Posted: Sun Nov 16, 2008 2:45 am
by Kairu
Hi Acki,
I think you are right , it is problem with .netcp .
in native irrlicht you still can put the ->setText in the drawing loop without producing the error i mention, right?

arrg what should i do, seem like .netcp forum is abit slow.

Posted: Sun Nov 16, 2008 7:27 pm
by rogerborg
You should ask them. In fact, offer to help them out.