Draw 3D Line Color Incorrect

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
HondaDarrell
Posts: 20
Joined: Sun Aug 27, 2006 9:10 pm
Location: U.S.A.
Contact:

Draw 3D Line Color Incorrect

Post by HondaDarrell »

I have drawn a 3D line with different color or alpha, but only black is rendered. I am using SCOLOR(A,R,G,B) for color and direct3d9 for the driver.

What could be causing this?

Also, is it possible to increase the width of a line.
kevinlynx
Posts: 24
Joined: Mon Jun 18, 2007 3:45 pm

Post by kevinlynx »

i've no idea what happened to your code . But in my example code, i rendered a line every frame and the color is correct . And the color , of cource you must use SColor because the parameter is a SColor type.

Code: Select all

driver->draw3DLine( vector3df( 0, 100, 0 ), vector3df( 0, 0, 0 ), SColor( 255, 255, 0, 0 ) );
ps:
Did your render loop like this :

Code: Select all

    render a line
    scene manager draw all 
I think if you did that , i mean , draw a line before ISceneManager::drawAll , you will get a blank line . I suppose you should :

Code: Select all

manager->drawAll();      
driver->draw3DLine( vector3df( 0, 100, 0 ), vector3df( 0, 0, 0 ), SColor( 255, 255, 0, 0 ) );
And the color now will be correct . :) good luck .
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

As with rendering other 3D primitives, you need to remember to set the material and transform before you draw them. If you don't add a dynamic light, set the material to disable lighting, or enable ambient lighting, the line won't be lit and will appear black.

Travis
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

You can't increase the width of the line unfortunately as then i guess it wouldn't technically be a line.. more a rectangle...

Not sure what other options there are, other than rendering a rectangle instead of a line. Or i suppose as it should be in 3d you'd want to render a cube that's stretched out.
Image Image Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

OpenGL does increase the line width, only d3d does not. This is a limitation in the architecture and can only be avoided by using a mesh instead of a line. This is, however, not yet done.
Post Reply