cannot use BillboardTextSceneNode and draw3dLine together

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
Kairu
Posts: 18
Joined: Mon Sep 08, 2008 11:03 am

cannot use BillboardTextSceneNode and draw3dLine together

Post by Kairu »

hi everyone
i cannot use billboardtext scene and draw3dline line together ,example below
i it really cannot is there other way to do it?

thanks

Code: Select all


#include <irrlicht.h>

using namespace irr;

#pragma comment(lib, "Irrlicht.lib")

int main()
{

   // create device
   IrrlichtDevice* device = createDevice( video::EDT_OPENGL, core::dimension2d<s32>(640, 480),
      16, false, false, true);

   if (device == 0)
      return 1; // could not create selected driver.

   video::IVideoDriver* driver = device->getVideoDriver();
   scene::ISceneManager* smgr = device->getSceneManager();

   scene::ICameraSceneNode * cam = smgr->addCameraSceneNodeMaya();
   cam->setPosition(core::vector3df(50,50,50));
   cam->setTarget(core::vector3df(0,0,0));
gui::IGUIFont* font = device->getGUIEnvironment()->getBuiltInFont();

// if i not include this billboardtextscene node i can draw the 3d line
   scene::ITextSceneNode*n = smgr->addBillboardTextSceneNode(font,L"yahoo",0,core::dimension2d< f32 >(10,10),
   core::vector3df(0,0,0),20,video::SColor(100,100,100,100),video::SColor(100,100,100,100));


   while(device->run())
   {
      driver->beginScene(true, true, video::SColor(255,255,255,255));

      smgr->drawAll(); // draw the 3d scene




      driver->draw3DLine(core::vector3df(0,0,0), core::vector3df(50,0,0),
                     video::SColor(255,255,0,0));

      driver->draw3DLine(core::vector3df(0,0,0), core::vector3df(0,50,0),
                     video::SColor(255,0,255,0));

      driver->draw3DLine(core::vector3df(0,0,0), core::vector3df(0,0,50),
                     video::SColor(255,0,0,255));

      driver->endScene();

   }

   device->drop();

   return 0;
}
Dark_Kilauea
Posts: 368
Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere

Post by Dark_Kilauea »

You need to set a material and a transformation for the driver before you use draw3DLine (or any draw* function for that matter)

See a scenenode's render() function for an example.
rogerborg wrote:Every time someone learns to use a debugger, an angel gets their wings.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Or just the documentation of IVideoDriver for the drawXXX functions ;)
Image Image Image
Kairu
Posts: 18
Joined: Mon Sep 08, 2008 11:03 am

Post by Kairu »

Thanks everyone , i finally managed to show both

another silly question is ,what wrong if i put

Code: Select all

            Dim material As New Material
            material.Lighting = False
            material.Wireframe = False
            driver.SetMaterial(material)
before the ' AddBillboardTextSceneNode '

why it doen't work this way? :?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

All you are doing here is setting the material to be used by the driver for the next draw call. This is only temporary, and anything that does any rendering will set the material it wants before it renders any primitives.

The scene node maintains its own material settings, and they are applied when the node is rendered. If you want to override the material settings used by a scene node, the ISceneNode interface has a set of methods that allow you to do just that.

Travis
Post Reply