ofParameter issue

#1

I’m quite new to C++, so the following is probably a result of that. I’m getting the following error:

of_v0.10.1_osx_release/libs/glm/include/glm/gtc/random.inl:262:4: Attempt to use a deleted function random.ini

Related to the “mean” parameter, I tried adding a listener but that also didn’t work. Any ideas?
Thanks in advance.


void ofApp::createCircles() {
    for (int i = 0; i < N; i++) {
        float rand = ofRandomf() * M_TWO_PI;
        
        float r = glm::gaussRand(mean, deviation); // <= ERROR
        
        ofLog() << r;
        
        float x = ofClamp(glm::cos(rand) * r, -areaRadius, areaRadius);
        float y = ofClamp(glm::sin(rand) * r, -areaRadius, areaRadius);
        
        points[i] = ofPoint(x, y);
        
        ofColor color = colors[(int)ofRandom(4)];
        color.a *= ofRandom(.5f, 1.f);
        pointColor[i] = color;
    }
}

//--------------------------------------------------------------
void ofApp::setup(){
    
    gui.setup("panel");
    gui.add(areaRadius.set("area radius", 200.f, 25.f, 500.f));
    gui.add(mean.set("mean", 100.f, 12.5f, 500.f));
    gui.add(deviation.set("deviation", 8.f, 0.5f, 50.f));
    gui.add(circleRadius.set("circle radius", 20.f, 1.f, 50.f));
    
    createCircles();
}
#2

glm functions only accept the exact type they need so you can’t pass an orParameter like that, just call get() on the parameter:

glm::gaussRand(mean.get(), deviation.get());
#3

Thanks a bunch @arturo!