Strange Problem related to 3dline drawing

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
Dragonair
Posts: 5
Joined: Fri Jan 02, 2009 11:20 am

Strange Problem related to 3dline drawing

Post by Dragonair »

hi ,
its my first post and m new here :)

straight to the problem ,

when i tried to draw a 3d line along with the gui env. , then whenever i clicked the menu , the line goes black colored.. where as i drawn it in white color ... :?

see herez the code :


Code: Select all

IrrlichtDevice *Device = 0;


class MyEventReceiver : public IEventReceiver
{
public:
        virtual bool OnEvent(const SEvent& event)
        {
		if(event.EventType==EET_GUI_EVENT)
		if(event.GUIEvent.EventType == EGET_MENU_ITEM_SELECTED)
			Device->getGUIEnvironment()->addMessageBox(L"asd",L"asd");
			
			}
	};

int main(){

	Device = createDevice(EDT_OPENGL, dimension2d<s32>(640,480),16);
	IGUIContextMenu *menu= Device->getGUIEnvironment()->addMenu();
	menu->addItem(L"file",-1,true,true);
	menu->getSubMenu(0)->addItem(L"open",101);
	Device->getSceneManager()->addCameraSceneNodeFPS();
	Device->getSceneManager()->getActiveCamera()->setFarValue(20000.0f);
	

	bool c=false;
	while(Device->run()){
		Device->getVideoDriver()->beginScene(true,true,SColor(255,100,100,100));
		Device->getVideoDriver()->draw3DLine(vector3df(-50,0,0),vector3df(50,0,0),SColor(255,255,255,255));
		Device->getSceneManager()->drawAll();
		
		Device->getGUIEnvironment()->drawAll();
		
		tempNode=0;
		/tempNode = col->getSceneNodeFromCameraBB(Device->getSceneManager()->getActiveCamera());
		if(tempNode)
			c=true;
		else
			c=false;
		if(c)
			{
			Device->getGUIEnvironment()->getBuiltInFont()->draw(L"collision",rect<s32>(0,0,100,10),SColor(255,255,255,255));
			
			};
		if(!c){
			
			tempNode=0;
			}
		
		Device->getVideoDriver()->endScene();


		}
Device->drop();

	}
don't know if its a problem in code or in engine .. please tell me soon ... thankz :roll:
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: Strange Problem related to 3dline drawing

Post by randomMesh »

You need to set a proper material and transformation before drawing the line. Have a look at the API again.

And the correct forum for this question would be Beginners Help.
"Whoops..."
Post Reply