Subject:
|
Re: LDForge - dev. plans and call for help
|
Newsgroups:
|
lugnet.cad
|
Date:
|
Wed, 31 Mar 2010 21:17:31 GMT
|
Viewed:
|
21642 times
|
| |
| |
In lugnet.cad, Santeri Piippo wrote:
|
Polygon sorting - help needed
I need a little bit help, however. The polygon sorting algorithm I have right
now does not work properly. Currently its done by calculating the center of
the polygon by simply calculating the means of the coordinates.
How do existing programs - LDView in particular as its an OpenGL one too -
sort polygons? Id appreciate help tremendously here..
|
The only polygons that LDView sorts are transparent ones. Everything else is
handled by the OpenGL depth buffer (glEnable(GL_DEPTH_TEST), followed by
glDepthFunc(GL_LEQUAL)). Transparent polygons need to be sorted before being
drawn, and LDView does what you describe above for those. (Theres more to it
than that for transparent polygons; sorting is just one step.)
Sorting by the distance to the centroid is only an approximation, but its good
enough to look pretty good for transparent polygons. Its not good enough to
be used as the primary means of hiding geometry thats farther away from the
viewer.
--Travis
|
|
Message has 3 Replies: | | Re: LDForge - dev. plans and call for help
|
| (...) If you prefer not to sort at all you can use glEnable(GL_POLYGON_STIPPLE) for transparent polygons. It doesn't look nearly as good, but it's really easy to code. Have fun, Don (15 years ago, 31-Mar-10, to lugnet.cad, FTX)
| | | Re: LDForge - dev. plans and call for help
|
| --snip-- (...) Out of interest which centroid do you use? I would have thought that the bounding box center was better than the centre of all corner points (since these cluster around areas of high detail) but you've presumably tried different (...) (15 years ago, 31-Mar-10, to lugnet.cad, FTX)
| | | Re: LDForge - dev. plans and call for help
|
| (...) I see.. but problem is that if I use glEnable(GL_DEPTH_TEST) then my polygons won't render at all. Tutorials related to OpenGL explicitly told not to use GL_DEPTH_TEST because of this.. how did you avoid it? (15 years ago, 31-Mar-10, to lugnet.cad, FTX)
|
Message is in Reply To:
| | LDForge - dev. plans and call for help
|
| Hi folks, over the latter half of the year 2009 I've been planning and experimenting on the thought of a good CAD program for part authors. Now I'm unveiling my thoughts to the public, but this is not an announcement. It's too early for such. (...) (15 years ago, 31-Mar-10, to lugnet.cad, FTX)
|
12 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|