color of the 3d lines

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
reetu.raj
Posts: 17
Joined: Wed Aug 27, 2008 5:11 pm
Location: Orlando
Contact:

color of the 3d lines

Post by reetu.raj »

I have a written a code which displays 3d lines in the space , and they are colored but they appear black ...how to display colored lines ?
Can someone help me out here please. thanks.

Code: Select all

#include<stdio.h>
#include "irrlicht.h"

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#pragma comment(lib, "Irrlicht.lib")

int x,y;
float z;


/*
int main(){

	
	IVideoDriver* driver;
	ISceneManager* smgr;
	IGUIEnvironment* guienv;



	IrrlichtDevice *device =createDevice( video::EDT_DIRECT3D9, dimension2d<s32>(640,480), 16,false, false, false, 0);
	device->setWindowCaption(L"Test");

	driver = device->getVideoDriver();
	smgr = device->getSceneManager();
	guienv = device->getGUIEnvironment();

	ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
	camera->setPosition(vector3df(100,100,100));
	camera->setTarget(vector3df(0,0,0));
	device->getCursorControl()->setVisible(false);
	//smgr->setAmbientLight(video::SColorf(0.8,0.8,0.8,1));

	
	while(device->run()){
	
	driver->beginScene(true, true, SColor(255,255,255,255));
	smgr->drawAll();
	
	for(x=0;x<=100;x+=6)
		for(y=0;y<100;y+=6)
		{
			z = 0.01*x;
			driver->draw3DLine( vector3df(x,-y,z-1), vector3df(x,-y,z+1), SColor(255,255,0,0) );
			driver->draw3DLine( vector3df(x,-y-1,z), vector3df(x,-y+1,z), SColor(255,255,0,0) );
			driver->draw3DLine( vector3df(x-1,-y,z), vector3df(x+1,-y,z), SColor(255,255,0,0) );	
		}
			
	driver->endScene();
	
	}//while loop ends here
return 1;
}
[/img]
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

you'll have to use a material:

Code: Select all

SMaterial mt;
mt.AmbientColor = mt.DiffuseColor = mt.EmissiveColor = SColor(255, 255, 0, 0);
driver->setMaterial(mt); 
// now draw the lines...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
reetu.raj
Posts: 17
Joined: Wed Aug 27, 2008 5:11 pm
Location: Orlando
Contact:

Post by reetu.raj »

thanks !
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

You will also need either ambient light or a light scene node.
ehenkes
Posts: 47
Joined: Sun Aug 03, 2008 2:52 pm
Location: Germany
Contact:

Post by ehenkes »

Thank you for the help, had the same problem.
Post Reply