//-------------------------------------------------------------- void ofApp::draw(){ ofColor cyan = ofColor::fromHex(0x00abec); ofColor magenta = ofColor::fromHex(0xec008c); ofColor yellow = ofColor::fromHex(0xffee00); ofBackgroundGradient(magenta * .6, magenta * .4); ofNoFill(); easyCam.begin(); ofRotateXDeg(15); ofSetColor(0); ofDrawGrid(500, 10, false, false, true, false); // draw the path of the box ofSetLineWidth(2); ofSetColor(cyan); pathLines.draw(); // draw a line connecting the box to the grid ofSetColor(yellow); ofDrawLine(current.x, current.y, current.z, current.x, 0, current.z); ofTranslate(current.x, current.y, current.z); if( (current - previous ).length() > 0.0 ){ // translate and rotate every 3D object after this line to the current position and orientation of our line, but only if the line is longer than 0 or has a length rotateToNormal(current - previous); } ofSetColor(255); ofDrawBox(32); ofDrawAxis(32); easyCam.end(); }
//-------------------------------------------------------------- void testApp::draw(){ ofColor cyan = ofColor::fromHex(0x00abec); ofColor magenta = ofColor::fromHex(0xec008c); ofColor yellow = ofColor::fromHex(0xffee00); ofBackgroundGradient(magenta * .6, magenta * .4); ofNoFill(); easyCam.begin(); ofRotateX(15); ofSetColor(0); ofDrawGrid(500, 10, false, false, true, false); // draw the path of the box ofSetLineWidth(2); ofSetColor(cyan); pathLines.draw(); // draw a line connecting the box to the grid ofSetColor(yellow); ofLine(current.x, current.y, current.z, current.x, 0, current.z); // translate and rotate to the current position and orientation ofTranslate(current.x, current.y, current.z); rotateToNormal(current - previous); ofSetColor(255); ofDrawBox(32); ofDrawAxis(32); easyCam.end(); }
//-------------------------------------------------------------- void testApp::draw(){ ofxVec3f start(0, 0, 0); ofxVec3f end( panel.getValueF("xLength"), panel.getValueF("yLength"), panel.getValueF("zLength")); ofBackground(0, 0, 0); ofSetColor(255, 255, 255); ofPushMatrix(); ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2); glBegin(GL_LINES); glVertex3f(start.x, start.y, start.z); glVertex3f(end.x, end.y, end.z); glEnd(); rotateToNormal(end - start); glEnable(GL_LIGHTING); glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHT0); glEnable(GL_NORMALIZE); glutSolidCone(40, 200, 20, 20); glDisable(GL_LIGHTING); glDisable(GL_DEPTH_TEST); ofPopMatrix(); }
//-------------------------------------------------------------- void testApp::draw(){ ofBackground(0); ofNoFill(); easyCam.begin(); ofDrawAxis(32); pathLines.draw(); // draw the path of the box // translate and rotate to the current position and orientation ofTranslate(current.x, current.y, current.z); rotateToNormal(current - previous); ofBox(32); ofDrawAxis(32); easyCam.end(); }