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 ? http://www.opengl.org/discussion_boards/ubb/smile.gif

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.

Honk

12-18-2003, 07:11 AM

If you want to draw a line onto an already drawn polygon glPolygonOffset() is your friend.

Aquileo

12-18-2003, 09:59 AM

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?

Thank you very much.

maximian

12-18-2003, 10:22 AM

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.

Having 24 bits zbuffer will allow you to use a smaller value than 16 bits zbuffer, and it will depend on the z-near and z-far values.

Relic

12-19-2003, 05:54 AM

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.