How do I add weight to gluNurbsSurface

My nurbs’ ctrlpoints are arranged in triangle, so I have to add weight here. But I don’t know how to do. Please help me.

This is done with the fourth coordinate, each control point can have x,y,z,w where w is the weight of the control point, 1.0=“normal”


Thank you very much.
But How to use it to trim Nurb surface.This is four dimensions.
Please help me again.