www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: qjvictor on November 23, 2006, 04:45:58 pm

Title: how to draw a 2D line with color in 3D world?
Post by: qjvictor on November 23, 2006, 04:45:58 pm
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.
Title: how to draw a 2D line with color in 3D world?
Post by: EgonOlsen on November 23, 2006, 05:23:34 pm
Using the software or the hardware renderer? A horizontal, vertical or arbitrary line?
Title: SOFTWARE render
Post by: qjvictor on November 23, 2006, 05:53:26 pm
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?
Title: how to draw a 2D line with color in 3D world?
Post by: EgonOlsen on November 23, 2006, 05:58:56 pm
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.