Start a new topic

How to set matrix attributes to an fltMatrix record of just created node

Original Post by: rlopez3d Tue May 17 07:29:55 2011


If I create a group node I can’t assign a transformation matrix to node. I get every time error no matter the way:


For example the below code:


// Create the group node:

mgrec *groupRec = mgNewRec(fltGroup);


// Get the matrix record. It gives a valid pointer

mgrec *mat = mgGetAttRec(groupRec, fltMatrix, MG_NULL);


// Set the values contained in my grpMatrix to matrix attributes

int numElements = mgSetAttList(matrixRec,

fltMatrix00, grpMatrix(0,0),

...

...

fltMatrix33, grpMatrix(3,3),

MG_NULL );


I get numElements = 0 i.e. the mgSetAttList was not successful


if I try to use the command


mgbool ret = mgSetMatrix ( groupRec, fltMatrix, grpMatrix(0,0) );


I get ret = MG_FALSE


I would appreciate any help


Original Post by: SteveThompson Tue May 17 12:22:38 2011


You don't set a nodes matrix directly, instead you attach Transformation Records to the node as described in this previous forum thread:


support/discussions/topics/511


Also if you have OpenFlight 4.2 there is a FAQ describing this with sample code in the OpenFlight API Reference.

FAQ: How do I apply a matrix (transformation) to a node?

Original Post by: rlopez3d Tue May 17 12:59:58 2011


Thanks a lot !

Login to post a comment