polyline.curveTo(ofVec2f); // No matching member function for call to 'curveTo

Hello everyone,

I am doing a graphic tutorial from the Openframeworks book and there seem to be a conflict in the exemple code. Indeed, when I wan to use the x, y coordinates stored in my ofVec2f in a polyline.curveTo(); it says “No matching member function for call to ‘curveTo’”.

Here is the bit of code:

void ofApp::update(){

if (leftMouseButtonPressed) {

    ofVec2f mousePos(ofGetMouseX(), ofGetMouseY());
    if (lastPoint.distance(mousePos) >= minDistance) {
        currentPolyline.curveTo(mousePos);  // Here I get the error message
        lastPoint = mousePos;


And here is the ofBooks link:

Thank you!

Hello Juliette, welcome to the forum ;). If you change this line:

ofVec2f mousePos(ofGetMouseX(), ofGetMouseY());

to this:

ofPoint mousePos(ofGetMouseX(), ofGetMouseY());

Everything works fine. I am going to update the tutorial, many thanks for pointing this out.

@arturo, should curveTo accepts a glm::vec2 too? or are we ok with an ofPoint?

No, adding cast operators from ofVec2 -> glm::vec3 is problematic since it creates certain ambiguities and some code stopped compiling with very obscure errors

I was meaning glm::vec2 not glm::vec3 :wink: Anyway, the signature in the doc https://openframeworks.cc/documentation/graphics/ofPolyline/#show_curveTo says that curveTo it is supposed to accept ofVec2f, but it is not. We should fix the docs or the code.

no, ofPolyline now accpets glm::vec3 so in order to accept ofVec2f it would need to auto convert to glm::vec3 which is problematic

and yes the docs shouldn’t say that anymore

I see. Is it ok if I change the doc from:

void ofPolyline_::curveTo(const T &to, int curveResolution=20)


void ofPolyline_::curveTo(const glm::vec3 &to, int curveResolution=20)


that won’t make any difference since the default is already glm::vec3

Yes, but from a user perspective, if curveTo is giving me an error, it is probably more helpful to find a documentation that tells me which type should the argument has, instead of the generic T. Isn’t it?

1 Like