Skip to content

Commit

Permalink
Example fixes (#6431)
Browse files Browse the repository at this point in the history
* added sort() to image seq example.

* voice example fix

* fix web loader example

* fix glm issues with particleExample

* fix upside down model
  • Loading branch information
ofTheo committed Nov 5, 2019
1 parent 5134ed8 commit 177c1f4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
1 change: 0 additions & 1 deletion examples/3d/assimpExample/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ void ofApp::keyPressed(int key){
case '2':
model.loadModel("TurbochiFromXSI.dae");
model.setPosition(modelPosition.x, modelPosition.y, modelPosition.z);
model.setRotation(0, -180, 1, 0, 0);
ofEnableSeparateSpecularLight();
break;
case '3':
Expand Down
2 changes: 1 addition & 1 deletion examples/input_output/imageLoaderWebExample/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//========================================================================
int main( ){

ofSetupOpenGL(1024,768, OF_WINDOW); // <-------- setup the GL context
ofSetupOpenGL(1200,600, OF_WINDOW); // <-------- setup the GL context

// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
Expand Down
6 changes: 3 additions & 3 deletions examples/input_output/imageLoaderWebExample/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ void ofApp::setup(){
ofRegisterURLNotification(this);

//to load synchronously
img.load("http://images.wildmadagascar.org/pictures/bemaraha/tsingy_forest.JPG");
img.load("https://openframeworks.cc/about/0.jpg");
}

//--------------------------------------------------------------
Expand All @@ -29,7 +29,7 @@ void ofApp::update(){
//--------------------------------------------------------------
void ofApp::draw(){

ofSetColor(0, 0, 0);
ofSetColor(220);
ofDrawBitmapString("hit spacebar to load image from web", 10, ofGetHeight()-20);
if(loading)
ofDrawBitmapString("loading...", 10, ofGetHeight()+20);
Expand Down Expand Up @@ -58,7 +58,7 @@ void ofApp::exit() {
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
img.clear();
ofLoadURLAsync("http://images.wildmadagascar.org/pictures/bemaraha/tsingy_forest.JPG","tsingy_forest");
ofLoadURLAsync("https://openframeworks.cc/about/0.jpg","about");
loading =true;
}

Expand Down
4 changes: 3 additions & 1 deletion examples/input_output/imageSequenceExample/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ void ofApp::setup() {
ofDirectory dir;

int nFiles = dir.listDir("plops");
dir.sort();

if(nFiles) {

for(size_t i=0; i<dir.size(); i++) {

// add the image to the vector
Expand Down
2 changes: 1 addition & 1 deletion examples/input_output/systemSpeakExample/src/ofApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void ofApp::threadedFunction() {

// call the system command say
#ifdef TARGET_OSX
string cmd = "say -v " + words[step] + " "; // create the command
string cmd = "say " + words[step] + " "; // create the command
#endif
#ifdef TARGET_WIN32
string cmd = "data\\SayStatic.exe " + words[step]; // create the command
Expand Down
6 changes: 4 additions & 2 deletions examples/math/particlesExample/src/demoParticle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ void demoParticle::reset(){

pos.x = ofRandomWidth();
pos.y = ofRandomHeight();
pos.z = 0;

vel.x = ofRandom(-3.9, 3.9);
vel.y = ofRandom(-3.9, 3.9);
vel.z = 0;

frc = glm::vec3(0,0,0);

Expand All @@ -46,7 +48,7 @@ void demoParticle::update(){
if( mode == PARTICLE_MODE_ATTRACT ){
glm::vec3 attractPt(ofGetMouseX(), ofGetMouseY(), 0);
frc = attractPt-pos; // we get the attraction force/vector by looking at the mouse pos relative to our pos
glm::normalize(frc); //by normalizing we disregard how close the particle is to the attraction point
frc = glm::normalize(frc); //by normalizing we disregard how close the particle is to the attraction point

vel *= drag; //apply drag
vel += frc * 0.6; //apply force
Expand All @@ -57,7 +59,7 @@ void demoParticle::update(){

//let get the distance and only repel points close to the mouse
float dist = glm::length(frc);
glm::normalize(frc);
frc = glm::normalize(frc);

vel *= drag;
if( dist < 150 ){
Expand Down

0 comments on commit 177c1f4

Please sign in to comment.