glPolygonMode: GL_LINE is software and GL_FILL is hardware ?

I currently implemented a two pass algorithm for cel shading.
The second pass draw back facing triangles in Line mode with a LineWidth of 5.0
So FPS slow up to 50% if GL_LINE is used.
evertyhing run fine if GL_FILL used.
So my CPU is about 10% of use when two passes with fill, and 100% when second pass is Line mode.

May be GL_LINE polygon mode is software?

Has anyone an info about that?
Is there a way to draw outlines in cel-shading without these back facing polygon artifacts?


May be GL_LINE polygon mode is software?

It’s not that simple, but GL_LINE mode is notoriously slower than GL_FILL mode on consumer-level boards.

I think that on most consumercards lines are implemented as quads, so you get 2 triangles ( and a 50% slowdown) when using them. And in linemode (if my assumption is correct) you need to billboard the lines, and you get a much higher CPU usage

What Mazy said, plus if you are using GL_LINE_SMOOTH, then that will slow you down plenty.

I know that Nvidia uses the polygon trick for their lines. But the performance isn’t terrible.

I’ve known about the polygon trick, even ‘high end’ sgi systems have done this, but come on. Surely not all on the CPU, and there’s no need to billboard per se. It’s x&y after projection, the only issue might be pre homogeneous divide expansion of x&y depending on the implementation.

Even if this wasn’t supported in hardware, you’d at least simply generate the required quad vertices on the host and use a vertex program for the quad coordinate displacement. You may require some setup created on the CPU to cue the VP.

[This message has been edited by dorbie (edited 07-18-2003).]

Thanks for all point of view.

Yes I’ve noticed the performance hit when enabling GL_LINE_SMOOTH.

I’ll try your way.It seems a good idea.

(What a great forum )