Author Topic: how to draw a 2D line with color in 3D world?  (Read 2852 times)

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
how to draw a 2D line with color in 3D world?
« 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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
how to draw a 2D line with color in 3D world?
« Reply #1 on: November 23, 2006, 05:23:34 pm »
Using the software or the hardware renderer? A horizontal, vertical or arbitrary line?

Offline qjvictor

  • int
  • **
  • Posts: 77
    • View Profile
SOFTWARE render
« Reply #2 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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11776
    • View Profile
    • http://www.jpct.net
how to draw a 2D line with color in 3D world?
« Reply #3 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.