how to draw a 2D line with color in 3D world?

Started by qjvictor, November 23, 2006, 04:45:58 PM

Previous topic - Next topic

qjvictor

I need a 2D line to split the 3D world, and the 2D line should be in red or green, how could I do this?
and what's the pixel position of 2D line?

Thanks.

EgonOlsen

Using the software or the hardware renderer? A horizontal, vertical or arbitrary line?

qjvictor

The line's position will be changed according to the position of a 3D object in the screen. It depends on the camera's angle.
Is there any method to change the 3D position to 2D position in screen?

EgonOlsen

You can use Interact2D.project3D2D()...this thread covers a similar topic: http://www.jpct.net/forum/viewtopic.php?t=663
However, when using the hardware renderer, you've to use the OpenGL-binding directly to draw the line. When using the software renderer, you can use Java2D for that.