Glm::vec3 and ofVec3f conflict

Hello,
I’m using openCV to create contours from kinect, and I’m now trying to use the ofxTriangle addon to triangulate the contour into a mesh.

The problem is that the ofxTriangle needs an ofVec3f while the contour returns a glm::vec3.

I’ve looked around and found this post:
https://openframeworks.cc/learning/02_graphics/how_to_use_glm/

But I can’t quite understand what does it mean to “define the OF_USE_LEGACY_MESH constant in ofConstants.h”.

I have the ofConstants.h open here and tried to type "#define OF_USE_LEGACY_MESH " at the end of it assuming it would work, but it didn’t.

Can someone share some light into this? How can I define that constant in Constants.h? Or is there a way to convert glm::vec3 into ofVec3f? Or should I just use an older version of openframeworks, which I really didn’t wanted to do…

Hi!

You can do:


if( contourFinder.blobs.size() ){
  vector <ofVec3f> pts; 
  //grab the contour from the first blob 
  auto contourPts = contourFinder.blobs[0].pts; 

  for(auto pt : contourPts){
    pts.push_back(pt); 
  }
}

And now you can use the pts vector with ofxTriangle.

fyi contourFinder is just how I have named it in this example.
I hope that helps.

Theo