Problems with draw2DLine and draw3DLine

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
bogQ
Posts: 11
Joined: Sat Jan 09, 2010 1:06 pm

Problems with draw2DLine and draw3DLine

Post by bogQ »

Im testing and playing around with lines in 3d space and on screen, and i stumbled on a problem

red line (on first picture) is from draw3DLine
red line is 3D position from camera direction 3d location (camera look@ pos) to 3d object in space and that part is ok

green line is from draw2DLine
green line with screen coordinates starting point (10,1) end point (100,100)

so after i draw gui im draw that 2 lines
first draw3DLine and then draw2DLine


but when draw3DLine + draw2DLine green line with screen coordinates starting point (10,1) end point (100,100) behave similar like 3d space point in draw3DLine.
(first picture)

Image

if i remove draw3DLine leaving only draw2DLine then draw2DLine starts to act like it should on screen coordinates and not as a point in 3D space, so green line is correctly displayed in upper left corner.
(second picture)

so draw3DLine + draw2DLine problem (look at first picture)
if draw2DLine only, no problem (second picture small green line in left upper corner on screen)

Any idea why this is happening?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Problems with draw2DLine and draw3DLine

Post by CuteAlien »

Please always post your real code with such problems, it's really hard to understand what's going on when someone translates c++ into english first. We read code faster :-)
Do you set the transformation correct before drawing your lines? You need a call like:

Code: Select all

 
driver->setTransform(video::ETS_WORLD, core::IdentityMatrix);
 
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
bogQ
Posts: 11
Joined: Sat Jan 09, 2010 1:06 pm

Re: Problems with draw2DLine and draw3DLine

Post by bogQ »

did not know that i need to use it coz when using only draw2DLine it looked ok and did not need setTransform :roll:
adding setTransform did correct my lack of knowledge, tu for help CuteAlien
Post Reply