Topic: draw3DLine?

Two questions, first when do I need to call draw3DLine, does it need to be after Driver.BeginScene and before smgr.drawAll?

Also, it doesnt work. (Well _SColor doesnt make a difference to the color, as they are always black) so what am I doing wrong

Re: draw3DLine?

greetings smile  draw3Dline (and the other draw commands) are tricky.  they must be called after drawAll() and before endscene.  in addition, they use the last set material and matrix so you need to set those to something default as well.  for an example you can examine the latest iB3D.  here is some sample code:

Local material:SMaterial=SMaterial.create()
driver.SetTransform(ETS_WORLD,Matrix4.create())
driver.draw3dLine(_VECTOR3DF(0,0,1),_VECTOR3DF(0,0,100),_SCOLOR(0,255,255,0))

try out the above and see what she does.  i dont remember an issue with the color.

3 (edited by H&K 2007-03-29 21:25:43)

Re: draw3DLine?

Strict

Framework brl.blitz

Import irrlicht.core

'Global device:IrrlichtDevice =IrrlichtDevice.Create(EDT_SOFTWARE,_DIMENSION2DI(512,384),32,False,True,False,Null)
Global device:IrrlichtDevice =IrrlichtDevice.Create(EDT_SOFTWARE2,_DIMENSION2DI(512,384),32,False,True,False,Null)
'Global device:IrrlichtDevice =IrrlichtDevice.Create(EDT_OPENGL,_DIMENSION2DI(512,384),32,False,True,False,Null)
'Global device:IrrlichtDevice =IrrlichtDevice.Create(EDT_DIRECT3D8,_DIMENSION2DI(512,384),32,False,True,False,Null)
'Global device:IrrlichtDevice =IrrlichtDevice.Create(EDT_DIRECT3D9,_DIMENSION2DI(512,384),32,False,True,False,Null)

Global Driver:IVideoDriver = device.getVideoDriver ()
Global smgr:ISceneManager = device.getSceneManager()
Global guienv:IGUIEnvironment = device.getGUIEnvironment()

Global Cam:ICameraSceneNode = smgr.addCameraSceneNode (Null,_VECTOR3DF(0,1,0),_VECTOR3DF(0,0,0))

While (device.Run())

Driver.BeginScene(True,True, _SCOLOR(255,255,255,255))

smgr.drawAll()

Local material:SMaterial=SMaterial.Create()
Driver.SetTransform(ETS_WORLD,Matrix4.Create())
Driver.draw2DLine (_POSITION2DI(256,192),_POSITION2DI(256,10),_SCOLOR(255,255,0,255))
Driver.draw3DLine (_VECTOR3DF(0,0,0),_VECTOR3DF(-1,0,0),_SCOLOR(255,255,0,255))

Driver.EndScene()
    
Wend

device.drop()

Do you get the same results with all of these.

Re: draw3DLine?

the software renderers appear to have issues as they only showed one distinct line.  the other 3 all represented the same thing (two lines).  what are you seeing?

Re: draw3DLine?

Well one of the software worked (Pink line up, Pink Line Down), one software render gives only the pink line up.

The three hardware give a pine line up, but a black line down. (When you say two lines, do you mean two pink lines, or a pink and black line?)

Re: draw3DLine?

ha ha, fixed it. (Ok so I went to the irrlicht boards and did a search, but that still counts wink , the code you posted above also needs to turn the material lighting off and be selected, so

Local material:SMaterial= SMaterial.Create()
material.setLighting(False)
driver.setMaterial(material)
Driver.SetTransform(ETS_WORLD,Matrix4.Create())

The software1 driver still doesnt work correctly, but at least the other four now give the same results wink

Re: draw3DLine?

ah.  my apologies on that.  i took the code and edited it from my original notes.   unfortunately i chopped out the most important part which was the driver.setMaterial() call.  sorry for the runaround on that <cant believe i did that> sad

you can also check out draw.bmx of iB3D for an implementation.

Re: draw3DLine?

NO worries about the runaround, its given my more confidence to simple look the answer up on the irrlicht boads, which I have been loath to do because of the obvious cross-cross-platform problems.