Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Editing Vertices in a Mesh/Sphere

$
0
0

@makakken wrote:

float deformFreq = 10;
    float deform = 3;
    float rad = 5;
    
    ofMesh vertices = sphere.getMesh();
    for(int i = 0; i > vertices.getNumVertices(); i++) {
        glm::vec3 v = vertices0[i];
        v = glm::normalize(v);
        float sx = sin(v.x * deformFreq);
        float sy = sin(v.y * deformFreq);
        float sz = sin(v.z * deformFreq);
        v.x += sy * sz * deform;
        v.y += sx * sz * deform;
        v.z += sx * sy * deform;
        v *= float(rad);
        vertices.setVertex(i,v);
    }

if i run this code in an actual Version of openFrameWorks, i still see an unmodified sphere. Can Anyone help please? How to properly edit the Vertex of a sphere?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles