How to implement the Smooth shading ?

Hi,

I displyed the 3D object by joining large number of triangles in a window.Three vertices of each triangles are storied in a linked list.In the Display function ,reads the triangle list and display the object. I want to give the smooth shade model to the displayed object.

I read about Gouraud and Phong shading for that.gl functions (glNormal(),glPolygonMode(),glShadeModel(),etc…)is not sufficient for implementing smooth shading?

How i can implement it?

Regrds,
Jerry

First of all, I think it is very bad (from the performance point of view) for your triangles to be held in linked list…

As for the shading part, you should provide OpenGL with vertex normals, not face normals.

jerin3D -

I’m not sure that I’m understanding quite what your question is - are you having problems getting smooth-shading in GL, or are you asking if GL can do it?

I’ll start with the second - Yes, GL can do it, and quite well (IMHO).

Second, you will probably need to do some averaging of your vertex normals - search this forum for discussions of it - I’m sure there are about 8 million posts! Then, if you’ve got everything set up correctly, you should have a very nice looking smooth surface.

Finally, I’ll second the above remark about linked lists - unless you absolutely need them, they tend to use way too much memory and be way too slow for graphics applications.

Good luck,
Chris