I am working on adaptive NURBS tessellation and I found a strange behavior in GLU. Please, take a look on attached screenshots.

1.jpg - flat trimmed patch
2.jpg - same setup but curved patch

Both of them are NURBS, the only difference is in control points. Why the tessellation on the edge looks great in 2.jpg and terrible in 1.jpg? The same for inner trim by the way (not in the pictures). I guess OpenGL (well, GLU) wrongly sample the trimmed edge in a case of flat patch.

Code looks like that:

Code :
       gluBeginSurface(theSurface);
            gluNurbsSurface(theSurface, 8, knots, 8, knots, 4 * 3, 3, &controlPoints[0][0][0], 4, 4, GL_MAP2_VERTEX_3);
                gluBeginTrim(theSurface);
                    gluNurbsCurve(theSurface, 8, curveKnots, 2, &edgePt_1[0][0], 4, GLU_MAP1_TRIM_2);
                    gluNurbsCurve(theSurface, 8, curveKnots, 2, &edgePt_2[0][0], 4, GLU_MAP1_TRIM_2);
                gluEndTrim(theSurface);
                gluBeginTrim(theSurface);
                    gluNurbsCurve(theSurface, 8, curveKnots, 2, &curvePt_1[0][0], 4, GLU_MAP1_TRIM_2);
                    gluNurbsCurve(theSurface, 8, curveKnots, 2, &curvePt_2[0][0], 4, GLU_MAP1_TRIM_2);
                gluEndTrim(theSurface);
        gluEndSurface(theSurface);

I would like to ask for any advice or available fix.

1.jpg
Click image for larger version. 

Name:	1.jpg 
Views:	38 
Size:	13.1 KB 
ID:	2721

2.jpg
Click image for larger version. 

Name:	2.jpg 
Views:	36 
Size:	22.7 KB 
ID:	2722