Irrlich + Bullet - Draw 3D Line problem

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
Nsty
Posts: 2
Joined: Sun Aug 18, 2013 9:18 pm

Irrlich + Bullet - Draw 3D Line problem

Post by Nsty »

Hello everyone,
I've been trying to integrate irrlicht with bullet when I encountered a problem with Bullet Debug Draw.
It requires to implement a DrawLine method which I didn't manage to do so far. I've tried to use pure OpenGL with GLUT as:

Code: Select all

    glBegin(GL_LINES);
    glColor3f(fromColor.getX(), fromColor.getY(), fromColor.getZ());
    glVertex3d(from.getX(), from.getY(), from.getZ());
    glColor3f(toColor.getX(), toColor.getY(), toColor.getZ());
    glVertex3d(to.getX(), to.getY(), to.getZ());
    glEnd();
 
But when i run this code inside the: driver->beginScene(); and driver->endScene(); nothing gets drawn.
Then I found the driver->draw3DLine() function but there seems to be a problem with coordinates. Objects gets drawn but it looks like they are flat (Y dimension of each object is close to 0) and they are 'missplaced'. Aditionally no mather what I pass as SColor all lines are always black.

I'd be greatfull for any advice :)
Isomorphix
Posts: 16
Joined: Fri Aug 16, 2013 5:08 pm

Re: Irrlich + Bullet - Draw 3D Line problem

Post by Isomorphix »

If you want to display a line as if your monitor was a paper that you just drew on,

then this

Code: Select all

 
glBegin(GL_LINES);
    glColor3f(fromColor.getX(), fromColor.getY(), fromColor.getZ());
    glVertex3d(from.getX(), from.getY(), from.getZ());
    glColor3f(toColor.getX(), toColor.getY(), toColor.getZ());
    glVertex3d(to.getX(), to.getY(), to.getZ());
glEnd();
 
should be this

Code: Select all

 
glBegin(GL_LINES);
    glColor3f(fromColor.getX(), fromColor.getY(), fromColor.getZ());
    glVertex3d(from.getX(), from.getY(), 0.0f);
    glColor3f(toColor.getX(), toColor.getY(), toColor.getZ());
    glVertex3d(to.getX(), to.getY(), 0.0f);
glEnd();
 
By the way, glColor3f is in RGB ... not XYZ, your code might confuse others :wink:
randomMesh
Posts: 1186
Joined: Fri Dec 29, 2006 12:04 am

Re: Irrlich + Bullet - Draw 3D Line problem

Post by randomMesh »

Look here
"Whoops..."
Nsty
Posts: 2
Joined: Sun Aug 18, 2013 9:18 pm

Re: Irrlich + Bullet - Draw 3D Line problem

Post by Nsty »

thx for the fast replay. That just solved my problem. Somehow I didnt manage to find that linked topic with search.
I've been missing:
driver->setTransform(irr::video::ETS_WORLD, irr::core::IdentityMatrix);
and tha black color was the lightning issue :)
Post Reply