Trimming NURBS surface representing cylinder, sphere and torus

OpenGL has the function to render a NURBS surface trimmed by curves. So, I want to apply this function to represent quadric objects such as cylinder, sphere and torus trimmed by curves.
The trimming curves may be obtained by intersection between these objects. The following figure shows an example I tried. A cylinder and a sphere are modeled,[Fig.1(a)] and then the intersection curves are obtained between two objects [Fig.1(b)].
I want to trim the cylinder by the intersection curve. [Fig.1(c)]

In order to use the OpenGL function of NURBS surface, I used the OpenGL function, gluNurbsSurface( ) in representing the cylinder [Fig.2(a)], and trimmed the NURBS surface by the intersection curve. As shown in the image of the trimmed cylinder [Fig.2(b)], the obtained result seems not correct. The expected image of the correctly trimmed cylinder should look like Fig.2(c).

I want to know what I did wrong or if it is the limitation of OpenGL.
I will appreciate very much for any information regarding this problem.