www.jpct.net
jPCT - a 3d engine for Java => Support => Topic started by: angel-0ne on February 05, 2010, 01:55:02 pm
-
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.
-
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.
-
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);
-
Thank you. It helps a lot ;)