#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
ofSetWindowTitle( "Wireframe Sphere" );
ofSetWindowShape(1280, 720);
ofSetFrameRate(60);
sphere.set(250,20);
vertices0 = sphere.getMesh().getVertices();
}
//--------------------------------------------------------------
void ofApp::update(){
}
//--------------------------------------------------------------
void ofApp::draw(){
float deformFreq = 120;
float deform = 10;
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);
}
draw3d();
}
//--------------------------------------------------------------
void ofApp::draw3d(){
material.begin();
ofEnableDepthTest();
float time = ofGetElapsedTimef();
float longitude = 10*time;
float latitude = 10*sin(time*0.8);
float radius = 600+50*sin(time*0.4);
// cam.orbitDeg(longitude, latitude, radius, ofPoint(0,0,0) );
cam.begin();
light.setPosition(0, 0, 600);
light.enable();
ofSetColor(ofColor::white);
sphere.draw();
cam.end();
ofDisableDepthTest();
material.end();
light.disable();
ofDisableLighting();
}
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?