Edge Flag annomaly

I’ve just spent the past couple of days debugging my engine. It used to run along quite nicely at ~90fps (with 20K tris visible) but recently it’s been running at ~14fps.
I eventually tracked the problem down to the following statement:

At first I thought it was the way I was calling the function that was slowing it down. But I’ve also tried calling it as “glEdgeFlag(1);” with exactly the same results.

As you can imagine I would rather have my 90fps than perfect wireframe. But would be nice to have my cake and eat it too.
P.S. I am using Display Lists and I’m pretty sure I’m disabling most unnecessary states.

Is this a known problem with GeForce2s?

Edge flags suck.

You said you’re using display lists. We probably turn off some of our optimizations for display lists the moment we see an edge flag.

Again, edge flags suck. Don’t use edge flags. Edge flags should never have been included as a feature in OpenGL, right up there with selection/feedback, Material inside a Begin/End, and DrawBuffer FRONT_AND_BACK.

I think it’s also safe to say that we are not the only HW vendor who dislikes edge flags.

  • Matt

Apparently I’ve hit a common vein… hehe.

OK, fair enough. IHVs don’t like EdgeFlags, selection and feedback. Shame. That explains why these three have been giving me such a headache over the past 2 weeks.
But why are they so unloved? They all seem rather simple in principle and EdgeFlags DO make for MUCH nicer looking wireframes when exporting from commercial apps (such as 3DS MAX).

Selection and feedback: OpenGL should be a low-level graphics rendering API, not a graphics utility library. These bloat the API and make it less focused on what really matters. Putting these features in HW makes very little sense, as they involve writing data back to the CPU, which is a bad thing in a graphics pipeline, and selection can usually be implemented far more efficiently inside an app, because the app knows its data structures best and can apply algorithms like bounding box/sphere tests, accurate ray intersections for quadrics, etc.

Edge flags: These only matter when you use PolygonMode in the first place, and PolygonMode is a bad way to draw wireframes; drawing a bunch of GL_LINE_STRIP primitives is generally the preferred way to go for highest efficiency. They’re also the only bit of per-vertex state that is a boolean (everything else is or can be made into a float).

The reason that PolygonMode wireframes and point rendering are bad is that they render each line twice and each point many times. Edge flags, in theory, would allow you to render each line just once, but only with great difficulty.

  • Matt