void update() { if( goFullscreen == 2 ){ ofSetFullscreen(false); ofSetWindowPosition(1920, 0); } if( goFullscreen == 4 ){ ofSetFullscreen(true); ofViewport(ofGetNativeViewport()); } goFullscreen++; if(goFullscreen > 4 && ofGetWindowPositionX() < 1440) { goFullscreen = 0; } renderTimer.tick(); while(osc.hasWaitingMessages()) { ofxOscMessage msg; osc.getNextMessage(&msg); if(msg.getAddress() == "/lookAngle/set") { targetLookAngle = msg.getArgAsFloat(0); } if(msg.getAddress() == "/lookAngle/add") { targetLookAngle += msg.getArgAsFloat(0); ofLog() << "targetLookAngle: " << targetLookAngle; } if(msg.getAddress() == "/screenshot") { saveScreen("button/"); } } lookAngle = ofLerp(lookAngle, targetLookAngle, .1); if(screenshotTimer.tick()) { // saveScreen("automatic/"); // uncomment to enable automatic screenshot } }
void drawScene() { ofPushMatrix(); ofScale(100, -100, 100); // avoid clipping ofRotateX(+90); ofRotateZ(+lookAngle); cam.bind(); fisheye.draw(); cam.unbind(); ofPopMatrix(); if(debug) { ofDisableDepthTest(); ofTranslate(-50, 0, -100); ofScale(1, -1, 1); ofSetDrawBitmapMode(OF_BITMAPMODE_MODEL); ofDrawBitmapStringHighlight("Camera: " + ofToString((int) cameraTimer.getFramerate()), 0, 0); ofSetDrawBitmapMode(OF_BITMAPMODE_MODEL); ofDrawBitmapStringHighlight("Render: " + ofToString((int) renderTimer.getFramerate()), 0, 40); } }
void draw() { cam.drawColor(); ofDrawBitmapStringHighlight(ofToString((int) timer.getFramerate()), 10, 20); }
void update() { if(cam.update()) { timer.tick(); } }