To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 11069
11068  |  11070
Subject: 
Re: LDForge - dev. plans and call for help
Newsgroups: 
lugnet.cad.dev
Date: 
Wed, 31 Mar 2010 22:59:53 GMT
Viewed: 
30223 times
  
In lugnet.cad, Santeri Piippo wrote:
   In lugnet.cad, Travis Cobbs wrote:
   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.

--Travis

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?

In order for GL_DEPTH_TEST to work, you have to clear the depth buffer at the same time you clear the rest of the screen:

glClearDepth(1.0);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

(Note: the glClearDepth() and glClearColor() calls above aren’t really necessary, since they pass the OpenGL default values, but just in case you used some other value, the above is what you want for glClearDepth().)

--Travis



Message has 1 Reply:
  Re: LDForge - dev. plans
 
(...) Ah, thank you Travis! I got depth buffering working now. :) No more problems with polygon sorting.. -Santeri (15 years ago, 1-Apr-10, to lugnet.cad.dev, FTX)

Message is in Reply To:
  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)

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