| | 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 (...) (15 years ago, 31-Mar-10, to lugnet.cad, FTX)
|
|
| | 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
|
|
(...) For transparency, LDView sorts triangles, and only triangles, not parts. So the centroid of each triangle is (p1 + p2 + p3) * (1/3). All transparent geometry in the whole model goes into one big list of triangles. While I'm at it, I calculate (...) (15 years ago, 31-Mar-10, to lugnet.cad.dev, 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)
|
|
| | Re: LDForge - dev. plans and call for help
|
|
(...) 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(GLCOLORBUFFERBIT GLDEPTHBUFFERBIT); (Note: the (...) (15 years ago, 31-Mar-10, to lugnet.cad.dev, FTX)
|
|
| | 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)
|
|
| | 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 (...) (15 years ago, 1-Apr-10, to lugnet.cad, lugnet.cad.dev, FTX)
|