To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 17132
17131  |  17133
Subject: 
Re: LDForge - dev. plans and call for help
Newsgroups: 
lugnet.cad
Date: 
Wed, 31 Mar 2010 21:53:37 GMT
Viewed: 
20984 times
  
In lugnet.cad, Travis Cobbs wrote:
   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 it’s done by calculating the center of the polygon by simply calculating the means of the coordinates.

How do existing programs - LDView in particular as it’s an OpenGL one too - sort polygons? I’d 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. (There’s 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 it’s good enough to look pretty good for transparent polygons. It’s not good enough to be used as the primary means of hiding geometry that’s farther away from the viewer.

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



Message has 1 Reply:
  Re: LDForge - dev. plans and call for help
 
(...) If you want a visual example on stipple, look at my LD4DStudio, it uses it for transparent stuff. In combination with depth buffer you don't need to sort anything just push the triangles and/or quad cords using glDrawElements and optionally (...) (14 years ago, 1-Apr-10, to lugnet.cad, lugnet.cad.dev, FTX)

Message is in Reply To:
  Re: LDForge - dev. plans and call for help
 
(...) 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 (...) (14 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
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR