Originally posted by Aquileo: I already have two points of the line on the surface.

So what ? Just draw a line between the two points.

Ah, it is not what you meant maybe ?

Principle :

Well, try to find the nearest triangle for each of you endpoints (A and B). Nice. Now find each adjacent triangle for A. Repeat recursively for each of these adjacent triangles. Once you find triangle B you are done.

Optimizations :

Try to precompute and store all the directly adjacent triangles for each triangle.

if you want to find the ‘shortest way’ (in number of triangles) to reach triangle B, do a breath-first graph/tree traversal. If you don’t understand this, try to find google docs/tuts concerning ‘graph theory’ ‘tree traversal’ ‘depth first or breadth first traversal’ ‘binary search algorithms’ etc.

Hong, thank you, but my problem is that I have a lot of triangles (over 40.000 points, 80.000 triangles). How should I use glPolygonOffset with the triangles?

glPolygonOffset does not care about the number of polygons you have. You just need to pick the two values correctly. Best is to just experiment, since different dimensions of meshes coupled with the size of your view volume will affect glPolygonOffset.

As a reference I have used glPolygonOffset on
Models w/ 60,000 -100,000 polygons multipass and had no problems. But models were scaled down to with less 5 units.

Not exactly, polygon offset factors and units are expressed in minimum distinguishable zbuffer values.
Means the units parameters set to 1.0 should move the primitive one zbuffer value to the far direction in default settings.