5

I would like to draw a 3D segment from point (x1, y1, z1) to point (x2, y2, z2) in a Irrlicht 3D scene.

I am aware of the line3d class and of this addLine3d method but I don't understand how to use them. What is this IAttributes class?

Can someone provide a minimal example of how to do draw a 3d line?
You can assume that I know how to add a Camera and draw the scene.

Simon
  • 31,675
  • 9
  • 80
  • 92

1 Answers1

3

IAttributes is for serialization, you aren't trying to save a line, you want to draw one. Drawing something means setting the states in the driver (material and transforms), then telling the driver to draw it.

Your best option is to edit example 3 and replace drawVertexPrimitiveList with draw3DLine, then add your custom node to the scene manager like any other.

Gareth Davidson
  • 4,857
  • 2
  • 26
  • 45
  • 3
    Thank you. I ended up using `driver->draw3DLine(vector3df(x1, y1, z1), vector3df(x2, y2, z2));` which was exactly what I was looking for. I just called it between `driver->beginScene(...);` and `driver->endScene();` and it was enough. – Simon Apr 07 '11 at 18:19