Author Topic: 3d Line  (Read 6042 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
3d Line
« on: December 13, 2006, 07:35:16 pm »
How do I draw a line between two 3d coordinates?

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
3d Line
« Reply #1 on: December 13, 2006, 08:03:14 pm »
I can't try it here but I expect I figured it out (if it's wrong, please somebody say so):

SimpleVector p1 = Interact2D.project3D2D(camera, buffer, vertex1);
SimpleVector p2 = Interact2D.project3D2D(camera, buffer, vertex2);
graphicsInstance.drawLine(p1.x, p1.y, p2.x, p2.y);

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
3d Line
« Reply #2 on: December 13, 2006, 08:18:27 pm »
No, first of all, I dont know if using the Graphics object works on  openGl.

Then, simpleVector coordinates and position of vector are not in a relationship with the x and y of the screen. you can have a 800 x 600 screen resolution but inside your Worlc you can have more that that amount of points, so you may need get the projection of each of those 2 points on the screen and then you can use the X and Y to draw the line.
Nada por ahora

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
3d Line
« Reply #3 on: December 14, 2006, 02:27:02 am »
And yet it worked. Read the documentation before saying I'm wrong. I appreciate the attention, but you might want to read the code before criticising it.

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
3d Line
« Reply #4 on: December 14, 2006, 03:28:40 am »
Yeah it worked because you are getting the projection of the 3d on the screen with the interact 2d, your code did exactly what I suggested to project the 3d over the 2d.

The problem was not ignoring how to do it, but putting few attention on your code to notice you were right. Check what I wrote and you will se that is exactly what you did.
Nada por ahora

Offline cyberkilla

  • float
  • ****
  • Posts: 413
    • View Profile
    • http://futurerp.net
3d Line
« Reply #5 on: December 14, 2006, 09:42:41 am »
Quote from: "AGP"
I can't try it here but I expect I figured it out (if it's wrong, please somebody say so):

SimpleVector p1 = Interact2D.project3D2D(camera, buffer, vertex1);
SimpleVector p2 = Interact2D.project3D2D(camera, buffer, vertex2);
graphicsInstance.drawLine(p1.x, p1.y, p2.x, p2.y);


I could have sworn that code was different the last time I looked:P

This code looks right though:).
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

Offline manumoi

  • long
  • ***
  • Posts: 121
    • View Profile
    • http://www.iro.umontreal.ca/~blanchae
3d Line
« Reply #6 on: December 15, 2006, 08:06:25 am »
wow people are nervous today  :wink: