I have four 3d cubic bezier curves that are interconnected. One bezier curve interconnects with the next one, and finally the last one interconnects with the first. However it does not conform to a standard bezier patch.

I have the control points for the curves but they are not set up properly? for a bezier patch. Does anyone know how I can convert these four interconnected bezier curves into a standard format for a bezier patch?

I have tried a lot of ideas but cannot seem to get it right. Any sample code would be greatly appreciated, since my math skills are limited.

Four Bézier curves connected at their endpoints gives you 12 control points. A patch needs 16, so you need four more, one for each corner.

Probably the best way to generate these is to choose the extra point so that the four points form a planar parallelogram. So if the corner point is P and the adjacent tangent points are U and V, the interior control point C is
C = P + (U - P) + (V - P) = U + V - P

The reason for this is that if you have a rectangular grid of patches, where each corner point is the midpoint of the adjacent tangent points in each direction, choosing the remaining point like this ensures C1 continuity across the edges.

I am having trouble understanding. Can you help me one more time.

I have:

EP0, CP0, CP1, EP1 First curve with two end points and two control points.
EP1, CP2, CP3, EP2 Next curve with shared end point from first curve.
EP2, CP4, CP5, EP3 etc.
EP3, CP6, CP7, EP0

If I understand you correctly, I can calculate another control point by CP8 = (CP0+CP7 - EP0) and similarily for the other three (CP9,CP10,CP11). However I need to rearrange my 4x4 matrix somehow to reflect these new control points and am not sure how the resulting matrix should look.

Could you please verify that I understand your proposal properly and how I should rearrange my 4x4 matrix.
Thanks.
Pat

EP0, CP0, CP1, EP1 First curve with two end points and two control points.
EP1, CP2, CP3, EP2 Next curve with shared end point from first curve.
EP2, CP4, CP5, EP3 etc.
EP3, CP6, CP7, EP0

If I understand you correctly, I can calculate another control point by CP8 = (CP0+CP7 - EP0) and similarily for the other three (CP9,CP10,CP11). [/QUOTE]
Yes.

IOW, the four curves form the boundary of the array, while the extra points fill in the centre cells.

Also, you may find that you need to transpose or flip the above array depending upon which side of the patch is supposed to be the “front” and which is the “back”. Rotation (i.e. which endpoint goes in the top-left corner) doesn’t matter.

No. See the part of my previous post that’s formatted as “code”.

The four curves should form the four edges of the “matrix”. I assume that you’re referring to the order in which glMap2() wants the data; if you’re using a tessellation shader, you can store the points however you want, but the operations naturally operate on rows and columns if you lay them out as I described.

In your reply, the left-hand edge is “EP0 CP2 CP4 EP2”, but that isn’t one of your curves. Similarly for the right-hand and bottom edges; only the top edge is correct.