Start a new topic

Failure to attach fltCurve to an object

I am able to attach other types of nodes to an object, but not a curve.

Here is the code I am using. Can anyone tell me if I am doing something incorrectly?


         //create a curve
        /* Create an object for a mesh nodes, attach it to the group*/
        /* add object comment */
        object = mgNewRec (fltObject);
        ok = mgAttach (group,object);

        curve = mgNewRec (fltCurve);
        ok = mgAttach (object,curve);                     //<<<<<<<<<<<<<<<<<<<<<<<  THIS ATTACH FAILS

        nAttributes = mgSetAttList (curve,fltCurveType , TEST_OF_CURVE_TYPE , MG_NULL);
        // create vertices, which will be the control points for the curve
        vertex = mgNewRec (fltVertex);
        ok = mgAttach (curve,vertex);
        ok = mgSetVtxCoord (vertex,1.0, 4.5, 0.0);


As quirky as it may seem, curves cannot be attached to objects. Objects can only contain polygons, meshes, points or light points. You can use mgValidAttach to check which record (node or transformation) types can attach to which other record types.

On a related note;

I can see how control points are added to a curve using mgSetVtxCoord, but

how is the knot vector read/written to a fltCurve record for a BSpline and Cardinal curve types.

Curves are fairly primitive in OpenFlight. They are mostly used as "construction helpers" in Creator. Anyway, they don't have knot vectors. They behave very much like "curve" (evaluators) in OpenGL. As such their curvature is completely defined by the placement of the control points.

Login to post a comment