How to draw a line?

Started by angel-0ne, February 05, 2010, 01:55:02 PM

Previous topic - Next topic

angel-0ne

Hello everyone.
I just wonna draw a line from (0,0,0) to (1,1,1) for example.
How can i do this?
Or, please, point into api.

EgonOlsen

Using which renderer? jPCT itself doesn't expose any line drawing capabilities, but depending on the renderer, you may use either Java2D or OpenGL yourself.

.jayderyu

you can use this


     Graphics g = frameBuffer.getGraphics();
     Camera cam = world.getCamera();

      //use whatever source vectors you want. if you want to show lines between children and parents
      // use Object3D.getTransformedCenter() instead of a new SimpleVector()
      SimpleVector pointA = Interact2D.project3D2D(cam, frameBuffer, new SimpleVector(0,0,0)); // start
      SimpleVector pointB = Interact2D.project3D2D(cam, frameBuffer, new SimpleVector(1,1,1)); // to

      g.drawLine((int)pointA.x, (int)pointA.y, (int)pointB.x, (int)pointB.y);


angel-0ne