How to use draw3DLine()

A forum to store posts deemed exceptionally wise and useful
Post Reply
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

How to use draw3DLine()

Post by jox »

Just a little tip:

If you wanna draw 3D lines with draw3DLine like this:

Code: Select all

driver->draw3DLine(vector3df(0,0,0), vector3df(0,10,0), SColor(0,0,0,0));
then it might not give you the expected result or even draw nothing.

to fix this you can set the transform and material of the driver before drawing lines, for example:

Code: Select all

driver->setTransform(video::ETS_WORLD, core::matrix4());
video::SMaterial m;
m.Lighting = false;
driver->setMaterial(m);

driver->draw3DLine(vector3df(0,0,0), vector3df(0,10,0), SColor(0,0,0,0));
(This tip is especially helpful if you forgot to look at the API docs where it says: "Note that the line is drawed using the current transformation matrix and material." ;) )
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Doesn't work for me, does the function even work?
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

It's funny, I believe that function works in Mercior's Newton Tutorial (or at least the updated version, which is available on the Newton site http://www.physicsengine.com). I have tried to use thta function myself for debugging Newton, but I can't get the function to draw anything, even if I seem to be doing it exactly the same way as in Mercior's tutorial.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

Hmm...

DX8/9? Or OpenGL?

Where are you using the function? e.g. in which part of the run() loop.

If you see bounding boxes and skeleton bones with debugDataVisible, then you actually see draw3DLine() in action.
It is like it is. And because it is like it is, things are like they are.
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

Using DX9 inside the drawing loop. I've not tried using debugDataVisible so I can't say whether that works either. I'll try it and come back.
Post Reply