making a path on the surface of 3D cube

i am a newbie at this forum, and actually i don’t use OpenGl, but LabView, but OpenGl documentation is always a better help, esp. in the case of 3D picture.

Anyway, i have a problem. Whenever i want to draw a path between two points on different face of a cube, this path will be drawn through the cube (logically), but it is not visible for the user. I want to draw it on the surface instead, for this reason i nead to find an edge between two faces, and may be determine a point on the edge as a third point and then connect points.The question is how i can determine this third one, which should be somewhere that makes the shortest path.
I am not sure about my idea, so i really appreciate to hear other ideas, or any kind of suggestion to solve this problem.


If you are after shortest path, imagine you unfold the cube faces, to a plane, like in this picture :

You have only 2 cases :

  1. a point in face 2 and a point in face 3
  2. a point in face 2 and a point in face 4

Then it is just a segment from both points, intersecting 1 or 2 cube edges, should not be too hard to compute.