shooth shading problems

Can anyone provide a sample code which demonstrates smooth shading on polygonal 3d objects.
I have my 3d object class which contains lists of polygon groups. each polygongroup have color and material properties, and list of Polygon objects. Polygon object contains list of vertices (represented by my Point3d class). It also has normal vector. So now this is how I draw object:

init method:


           gl.glShadeModel(GL.GL_SMOOTH);
            gl.glClearColor(0, 0, 0, 0);
            gl.glClearDepth(1);
            gl.glEnable(GL.GL_DEPTH_TEST);
            gl.glDepthFunc(GL.GL_LEQUAL);
            gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
            gl.glLightfv(GL.GL_LIGHT1, GL.GL_AMBIENT, lightAmbient);
            gl.glLightfv(GL.GL_LIGHT1, GL.GL_DIFFUSE, lightDiffuse);
            gl.glLightfv(GL.GL_LIGHT1, GL.GL_POSITION, lightPosition);
            gl.glEnable(GL.GL_LIGHT1);
            gl.glColorMaterial(GL.GL_FRONT, GL.GL_DIFFUSE);
            gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE);

display method:


        gl.glEnable(GL.GL_LIGHTING);
        gl.glEnable(GL.GL_COLOR_MATERIAL);
      
        for (PolygonGroup polygonGroup : polygonGroups)
        {
            gl.glMaterialfv(GL.GL_FRONT, GL.GL_DIFFUSE, polygonGroup.getDiffuseColor());
            gl.glMaterialfv(GL.GL_FRONT, GL.GL_SPECULAR, polygonGroup.getSpecularColor());
            gl.glMaterialf(GL.GL_FRONT, GL.GL_SHININESS, polygonGroup.getShinines());
            for (Iterator<Polygon> iter = polygonGroup.getPolygons().iterator(); iter.hasNext();)
            {
                float[] color = polygonGroup.getDiffuseColor();
                Polygon polygon = iter.next();
                gl.glBegin(GL.GL_POLYGON);
                Vector3D n = Math3D.getNormal(polygon);
                gl.glNormal3d(n.x, n.y, n.z);
                gl.glColor4f(color[0], color[1], color[2], 1);
                Point3D[] p = polygon.getPoints();
                for (int i = 0; i < p.length; i++)
                {
                    gl.glVertex3d(p[i].x, p[i].y, p[i].z);
                }
                gl.glEnd();
            }
        }
       

and after that my object looks like this:

http://dogbert.renderspace.si/~buzz/snapshot8.png

what’s wrong with this code ???

You have to specify normals for each vertex and you also have to make sure, that the vertices that specify the same point (the corners of your polygons) share the same normal.