//-------------------------------------------------------------- void ofApp::setup() { ofSetOrientation(OF_ORIENTATION_90_LEFT); ofSetLogLevel(OF_LOG_VERBOSE); ofBackground(0, 0, 0); ofSetVerticalSync(true); ofSetFrameRate(60); planet.setUseVbo(false); planet.set(1500, 50); planet.setPosition(0, 0, 0); easycam.setDistance(20); cam.setPosition(0, 0, 0); ofxAccelerometer.setup(); ofxRegisterAccelEvents(this); tracking.reset(); invert = ofNode(); node = ofNode(); view = ofMatrix4x4(); }
//-------------------------------------------------------------- void testApp::drawScene(bool isPreview){ glEnable(GL_DEPTH_TEST); if (isPreview) { ofPushStyle(); ofSetColor(150, 100, 100); ofDrawGrid(1.0f, 5.0f, true); ofSetColor(255); //-- //draw camera preview // headTrackedCamera.transformGL(); ofPushMatrix(); ofScale(0.002f, 0.002f, 0.002f); ofNode().draw(); ofPopMatrix(); ofMultMatrix(headTrackedCamera.getProjectionMatrix().getInverse()); ofPushStyle(); ofNoFill(); ofBox(2.0f); ofPopStyle(); headTrackedCamera.restoreTransformGL(); // //-- //-- //draw window preview // ofMesh window; window.addVertex(windowTopLeft); window.addVertex(windowBottomLeft); window.addVertex(windowBottomRight); window.setMode(OF_PRIMITIVE_LINE_STRIP); window.draw(); glPointSize(3.0f); window.drawVertices(); // //-- } ofPushStyle(); ofNoFill(); ofColor col(200,100,100); for (float z = 0.0f; z > -40.0f; z-= 0.1f){ col.setHue(int(-z * 100.0f + ofGetElapsedTimef() * 10.0f) % 360); ofSetColor(col); ofRect(-windowWidth / 2.0f, -windowHeight / 2.0f, z, windowWidth, windowHeight); } ofPopStyle(); ofPushStyle(); ofEnableSmoothing(); ofSetColor(255); ofSetLineWidth(5.0f); ofBeginShape(); for (int i=0; i<headPositionHistory.size(); i++) { ofPoint vertex(headPositionHistory[i].x, headPositionHistory[i].y, -float( headPositionHistory.size() - i ) * 0.05f); ofCurveVertex(vertex); } ofEndShape(false); ofPopStyle(); glDisable(GL_DEPTH_TEST); }