PDA

View Full Version : Faint lines on polygons



jerryyyyy
03-14-2003, 07:13 PM
I have a complex program which shows faint lines connecting vertices across rectangles, even if they are not made with triangle strips. Is there any way to get rid of this. Have tried various forms of antialiasing?????

shinpaughp
03-14-2003, 08:26 PM
A couple of questions, do you have glPolygonMode set up with GL_LINES for either front or back face? Do you have depth test enabled? Are you texture mapping, or just colors/material? Do you have lighting enabled?

jerryyyyy
03-14-2003, 09:03 PM
Here is the code I have for options. I have tried various antialiasing ones on and off. I am using texture is some polygones but see the lines faintly on those not mapped. Any help appreciated.

// Select GL options.
//glEnable(GL_BLEND);
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glEnable(GL_LINE_SMOOTH);
//glEnable(GL_POINT_SMOOTH);
//glEnable(GL_POLYGON_SMOOTH);

//glEnable(GL_DEPTH_TEST);
//glDepthFunc(GL_LESS);
//glClear(GL_DEPTH_BUFFER_BIT);
//p = gluNewQuadric();
//gluQuadricDrawStyle(p, GLU_FILL);
glFogi(GL_FOG_MODE, GL_EXP2);
glFogfv(GL_FOG_COLOR, fog);
glFogf(GL_FOG_DENSITY, fog_density);
glClearColor(fog[0], fog[1], fog[2], fog[3]);
glFogf(GL_FOG_START,10.0);
glFogf(GL_FOG_END, 12000.0);
glHint(GL_FOG_HINT, GL_NICEST);// Looks like GL_NICEST not implemented except with NVIDIA Card!!!!!!

//glFrontFace(GL_CW);
glEnable(GL_CULL_FACE);

shinpaughp
03-14-2003, 09:20 PM
Try it with //glEnable(GL_DEPTH_TEST); uncommented. Also, do you have glClear called at start of each rendering pass? If so, which buffer bits do you clear?

[This message has been edited by shinpaughp (edited 03-14-2003).]

jerryyyyy
03-15-2003, 01:30 PM
These suggestions seem to have solved the problem, but refresh rate is somewhat slowed.Any idea which of the options are the worst processor hogs? Thanks for the help.

shinpaughp
03-15-2003, 02:04 PM
The glHint of GL_NICEST because it tries to give most accurate correct results for the fog. Try it with GL_FASTEST and see if still looks okay and speeds up the fps.

shinpaughp
03-15-2003, 02:23 PM
Also, I see you enables GL_CULL_FACE... are you calling glCullFace(GL_BACK) or something? If you do not need to see the back of any polygons, this will speed it up a little.

Also, do you have fog enabled? glEnable(GL_FOG) or you aren't using it?

jerryyyyy
03-15-2003, 04:52 PM
I have fooled with this a lot today and have a pretty good idea of the problem. If I turn on the polygon antialiasing, I get slow performace and some little lines across the polygons. I really do not need point or line antialiasing and can turn that off. I need the fog for the flight simulation so need that on. The depth test does not seem to make much difference one way or another. Ultimately this runs on a fast Dell with an NVIDIA high-end processor.

Any suggestions about polygon antialiasing would be appreciated. There are so many options to hack away at and try. I may have to just turn it off. We are porting this simulation from an SGI machine and I turned it off there- I was just hoping the NVIDIA would surprise me with its speed etc.. It does the fog way better than our SGI Octane.

jerryyyyy
03-15-2003, 04:57 PM
On the Fog, I need Nicest which gives pixel rendition rather than vertices as this is a crucial part of the flight simulation. Works very fast with NVIDIA chip.

jerryyyyy
03-15-2003, 05:07 PM
I found this doing a search on polygon antialiasing- looks like some carefully setting need to be performed:

"Why do all these quality options give bad results?"
They don't, if they're used as they were meant to be.

Look at the Red Book chapter 6 on Polygon Antialiasing:

...
Now you need to blend overlapping edges appropriately. First, turn off the depth buffer so that you have control over how overlapping pixels are drawn. Then set the blending factors to GL_SRC_ALPHA_SATURATE (source) and GL_ONE (destination). With this specialized blending
function, the final color is the sum of the destination color and the scaled source color; the scale factor is the smaller of either the incoming source alpha value or one minus the destination alpha value. This means that for a pixel with a large alpha value, successive incoming pixels have little effect on the final color because one minus the destination alpha is almost zero. With this method, a pixel on the edge of a polygon might be blended eventually with the colors from another polygon that's drawn later. Finally, you need to sort all the polygons in your scene so that they're ordered from front to back before drawing
them.
...

(Or search the forum, you were not the first with this problem.)

"Why are these options ingnored by old graphic cards and interpreted wrong on new ones? "

Older chips (or drivers) probably didn't support it. Newer ones do the right thing (even if it's slow sometimes).

shinpaughp
03-15-2003, 06:09 PM
What kind of frames per second are you getting when it has the lines vs. not having the lines (antialiasing on/off)?

Any chance you could post a link to some screen shots? It might give me more ideas.

And, if you're really lucky, someone else with more experience than myself might come along and help out.

[This message has been edited by shinpaughp (edited 03-15-2003).]

jerryyyyy
03-15-2003, 07:01 PM
Apparent these lines are in part a quirk of the NVIDIA GeForce 4 card. I am testing these things at home with a laptop, but the main computer is at work so I will have to test it Mondasy. One of the my collegues here says there are some settings pertinant to antialiasing in the Xconfig file. We need to inform ourselves about the GeForce 4 card.

shinpaughp
03-15-2003, 08:47 PM
Are you running this on Linux? I assume xconfig and xwindows might go hand in hand. If so, you might try asking about the lines in the Linux section of the discussion group. Could be Linux related. Although I run Linux as well as Win2k, I have yet to do any programming on it.

Anyway, they may have thoughts and be better able to help you with known issues of compatibility, driver problems, etc. Just to check, have you upgraded to the latest drivers. Seems as though nVidia is updating them almost daily (slight exaggeration) even for Linux.