PDA

View Full Version : Smoothing vertices of a polygon



jenny_wui
01-21-2013, 09:29 PM
I would like to smoothen the vertices of polygon. How could that be done? I just want to avoid sharp edges? Please give me some suggestions.

Carmine
01-22-2013, 10:05 AM
I would like to smoothen the vertices of polygon. How could that be done? I just want to avoid sharp edges? Please give me some suggestions.


Each vertex must have a normal. If your surface comes from a modeling program
it may have vertex normals already computed for you. Otherwise you'll have to
compute them by averaging the polygon normals sharing each vertex. Then, before
drawing a vertex, call glNormal (.....). That's all there is to it. You must also turn
smooth shading on using the command below...


glShadeModel (GL_SMOOTH);


Note: These comments apply to Fixed Pipeline GL.

jenny_wui
01-22-2013, 12:13 PM
Actually I wanted to say that I have a contour (boundary) which is a connected set of vertices. It looks a bit rugged. I want to make it look a bit smooth keeping the number of vertices same, but vertex coordinates may be manipulated. How can that be done?