Deforming Sphere - Semantic Issues/Debug Issues


#1

I have written a program to deform the shape of a sphere where I have come across to errors in my code.

The first:
::setup

vertices0 = sphere.getMesh().getVertices();

! No viable overloaded ‘=’

The second:
::update

vector<ofPoint> &vertices = sphere.getMesh().getVertices();

! Non-const lvalue reference to type ‘vector’ cannot bind to a value of unrelated type ‘vector<glm::tvec3<float, glm::packed_highp>>’

I am using the ‘openFrameworks Essentials’ book for reference. But it was published in 2015 so might just be because the structure of the code has changed by then.

Any ways I can change these lines to make it work?


#2

Hi,
I think that this has been mentioned elswhere in the forum.
But anyways.
openFrameworks has deprecated ofPoint and ofVecf, ofQuaternion and ofMatrixx* and replaced by it’s GLM counterparts. So whereever you see an ofPoint or ofVec3f change for glm::vec3, ofVec2f and ofVec4f for glm::vec2 and glm::vec4 respectively, ofQuaternion for glm::quat and so on.
Usually these can get auto converted but it is not possible in the case of containers, such as vector<...>. Just make a search and replace and you should be done.