//-------------------------------------------------------------- void ofApp::draw() { ofEnableAlphaBlending(); ofSetColor(ofColor::white); video.draw(0,0); ofSetColor(255,0,0,127); //ofSetColor(ofColor::red); ofScale(0.7,0.7,0.7); ofTranslate(400,200); ofRotateX(rotate); ofRotateY(rotate); video.draw(0,0); ofDisableAlphaBlending(); ofSetColor(ofColor::blue); ofScale(0.7,0.7,0.7); ofTranslate(400,200); ofRotateX(rotate); ofRotateY(rotate); video.draw(0,0); ofSetColor(ofColor::green); ofScale(0.7,0.7,0.7); ofTranslate(400,200); ofRotateX(rotate); ofRotateY(rotate); video.draw(0,0); }
void ofApp::draw(){ ofSetColor(ofColor::white); video.draw(0,0); ofSetColor(ofColor::red); ofScale(0.7,0.7,0.7); ofTranslate(400,200); ofRotateX(rotate); ofRotateY(rotate); video.draw(0,0); grabber.draw(0,0); ofSetColor(ofColor::green); ofScale(0.7,0.7,0.7); ofTranslate(400,200); ofRotateX(rotate*3); ofRotateY(rotate); video.draw(0,0); grabber.draw(0,0); ofSetColor(ofColor::blue); ofScale(0.7,0.7,0.7); ofTranslate(400,200); ofRotateX(rotate); ofRotateY(rotate*3); video.draw(0,0); grabber.draw(0,0); }
void testApp::draw(){ // set up some basic lighting glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); glShadeModel(GL_SMOOTH); float noAmbient[] = {0.0f, 0.0f, 0.0f, 1.0f}; float whiteDiffuse[] = {1.0f, 1.0f, 1.0f, 1.0f}; float position[] = {1.0f, -1.0f, 1.0f, 0.0f}; glLightfv(GL_LIGHT0, GL_AMBIENT, noAmbient); glLightfv(GL_LIGHT0, GL_DIFFUSE, whiteDiffuse); glLightfv(GL_LIGHT0, GL_POSITION, position); ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2 , 0); // get the most up to date data ConnexionData& data = ofxConnexion::connexionData; // some of these things are negative, but might be different // depending on how you've configured your space navigator ofTranslate( data.translation[0], data.translation[1], -data.translation[2]); ofRotateX(-data.rotation[0]); ofRotateY(-data.rotation[1]); ofRotateZ(data.rotation[2]); ofSetColor(255, 255, 255); ofRotateX(180); glutSolidTeapot(200); }
//-------------------------------------------------------------- void ofApp::draw(){ ofBackground(0); ofSetColor(255); ofPath path; path.circle(100,100,20); path.circle(200,100,20); path.circle(100,200,20); path.draw(); ofPushMatrix(); ofTranslate(ofGetWidth()/4,ofGetHeight()/2); ofScale(100,100,100); ofRotateX((float)ofGetMouseY()/10.0f); ofRotateY((float)ofGetMouseX()/10.0f); sphere.drawWireframe(); ofPopMatrix(); ofPushMatrix(); ofTranslate(ofGetWidth()/4*3,ofGetHeight()/2); ofRotateX((float)ofGetMouseY()/10.0f); ofRotateY((float)ofGetMouseX()/10.0f); sphere2.drawWireframe(); ofPopMatrix(); angle+=1; }
void SmartViewportManager::drawViewportPreviews(){ ofPushMatrix(); ofPushStyle(); ofEnableAlphaBlending(); ofSetRectMode(OF_RECTMODE_CENTER); ofSetColor(255, 255, 255, viewportPreviewAlpha); // Move to center of world offset ofTranslate(centerOfWorldOffset); for (vector<SmartViewport*>::iterator it = smartViewports.begin() ; it != smartViewports.end(); ++it){ SmartViewport* smartViewport = *it; ofPushMatrix(); ofTranslate(smartViewport->getPosition()); ofVec2f rotXY = smartViewport->getRotationXY(); ofRotateY(rotXY.y); ofRotateX(rotXY.x); // Apply the camera to viewport offset ofTranslate(cameraToViewportOffset); // Fix upsidedonw image issue ofRotateX(180); smartViewport->drawViewportPreview(); ofPopMatrix(); } ofDisableAlphaBlending(); ofPopStyle(); ofPopMatrix(); }
//-------------------------------------------------------------- void ofApp::drawTexturedCylinder(){ // draw the texture-mapped cylinder. if ((ofGetWidth() > (playerScaleFactor*warpedW)) && (ofGetHeight() > unwarpedH)) { if (!bMousepressedInUnwarped){ // && !bMousePressedInPlayer){ float A = 0.90; float B = 1.0-A; blurredMouseX = A*blurredMouseX + B*mouseX; blurredMouseY = A*blurredMouseY + B*mouseY; } unwarpedTexture.bind(); glEnable(GL_DEPTH_TEST); glViewport(playerScaleFactor*warpedW, unwarpedH, ofGetWidth()-playerScaleFactor*warpedW, playerScaleFactor*warpedH); // magic numbers float cylz = (ofGetHeight()/768.0) * 300.0; float cylinderRadius = (ofGetHeight()/768.0) * 16*10.00; //175.0; float cylinderHeight = (ofGetHeight()/768.0) * 16*11.44/2.0; // 80.0; glPushMatrix(); glTranslatef(ofGetWidth()/2, ofGetHeight()/2,cylz); if (!bMousePressed){ glTranslatef(0,0,0); ofRotateX(RAD_TO_DEG * ofMap(blurredMouseY, 0, ofGetHeight(), -PI/2, PI/2)); ofRotateY(RAD_TO_DEG * ofMap(blurredMouseX, 0, ofGetWidth(), -PI, PI)); } else { float offsetForOpticalCenter = 0 - cylinderHeight*0.4; // the Bloggie optical center is not in the center of the image. glTranslatef(0, offsetForOpticalCenter,cylz); ofRotateX(RAD_TO_DEG * ofMap(blurredMouseY, 0, ofGetHeight(), -PI/4, PI/4)); ofRotateY(RAD_TO_DEG * ofMap(blurredMouseX, 0, ofGetWidth(), TWO_PI, -TWO_PI)); } ofSetColor(255,255,255); glBegin(GL_QUAD_STRIP); for (int i = 0; i < cylinderRes; i++) { float x = cylinderX[i] * cylinderRadius; float z = cylinderY[i] * cylinderRadius; float u = (float) unwarpedW / (cylinderRes-1) * i; glTexCoord3f(u, 0, 0); glVertex3f (x, 0-cylinderHeight, z); glTexCoord3f(u, unwarpedH, 0); glVertex3f (x, cylinderHeight, z); } glEnd(); glPopMatrix(); unwarpedTexture.unbind(); glDisable(GL_DEPTH_TEST); glViewport(0,0, ofGetWidth(), ofGetHeight()); } }
//-------------------------------------------------------------- void testApp::draw() { ofSetColor( 0 , 0 , 0 ) ; ofRect( -1000, -1000 , 3000, 3000 ) ; fadeFbo.begin() ; ofEnableAlphaBlending() ; ofSetColor( 0 , 0 , 0 , fadeAlpha ) ; ofRect( -1000 , -1000 , 3000, 3000 ) ; ofPushMatrix() ; //Offset by the center so that our openGL pivot point is in the center of the screen ofPoint center = ofPoint ( ofGetWidth() /2 , ofGetHeight() /2 ) ; ofTranslate( ofGetWidth() * .5 , ofGetHeight() * .5 ); ofRotateY( (mouseX / (float)ofGetWidth() +- .5 ) * 90.0f ) ; ofRotateX( (mouseY / (float)ofGetHeight() +- .5 ) * 90.0f ) ; //Draw particles //Begin the openGL Drawing Mode glBegin(GL_POINTS); //glBegin(GL_LINES); //glBegin(GL_TRIANGLES); ofEnableAlphaBlending() ; //Create an iterator to cycle through the vector std::vector<Particle>::iterator p ; for ( p = particles.begin() ; p != particles.end() ; p++ ) { glColor4ub((unsigned char)p->color.r,(unsigned char)p->color.g,(unsigned char)p->color.b , 215 ); glVertex3f(p->position.x - center.x , p->position.y - center.y , p->position.z ); } ofPopMatrix() ; glEnd(); ofRotateX( (mouseY / (float)ofGetHeight() +- .5 ) * -90.0f ) ; ofRotateY( (mouseX / (float)ofGetWidth() +- .5 ) * -90.0f ) ; ofTranslate( -ofGetWidth() * .5 , -ofGetHeight() * .5 ); fadeFbo.end() ; ofSetColor ( 255 , 255 , 255 ) ; fadeFbo.draw( 0 , 0 ) ; string springString = ( springEnabled == 0 ) ? "on" : "off" ; string repelString = (cursorMode == 0 ) ? "repulsion" : "attraction" ; string output = " S :: Springs on/off : " + springString + "\n C :: CursorMode repel/attract " + repelString + "\n currently drawing " + DIR.getName(curImageIndex) + "\n # of particles : " + ofToString( numParticles ) + " \n fps:" +ofToString( ofGetFrameRate() ) + "\n </> :: fadeAlpha: " + ofToString(fadeAlpha) ; ofEnableAlphaBlending() ; ofSetColor ( 255 , 255 , 255 , 255 ) ; images[curImageIndex].draw ( 10 , ofGetHeight() +- 325, images[curImageIndex].width/4 , images[curImageIndex].height/4 ) ; ofDrawBitmapString(output ,20,ofGetHeight() +- 100 ); }
void Panel::display() { if(bFlipping) { if(curr != NULL && next != NULL) { ofPushStyle(); ofEnableDepthTest(); ofSetColor(255); ofPushMatrix(); ofTranslate(bounds.getX(), bounds.getY()); next->drawSubsection(0, 0, bounds.getWidth(), bounds.getHeight()/2, 0, 0); curr->drawSubsection(0, bounds.getHeight()/2, bounds.getWidth(), bounds.getHeight()/2, 0, bounds.getHeight()/2); if(rot > rotThreshold) { ofPushMatrix(); ofTranslate(0, bounds.getHeight()/2); ofRotateX(rot); ofTranslate(0, -bounds.getHeight()/2); curr->drawSubsection(0, 0, bounds.getWidth(), bounds.getHeight()/2, 0, 0); ofPopMatrix(); } else { ofPushMatrix(); ofTranslate(0, bounds.getHeight()/2); ofRotateX(180 + rot); next->drawSubsection(0, 0, bounds.getWidth(), bounds.getHeight()/2, 0, bounds.getHeight()/2); ofPopMatrix(); } ofPopMatrix(); ofDisableDepthTest(); ofPopStyle(); } else { ofLogWarning("Panel::display()", "one or more of you images have not been set"); } } else { if(curr != NULL && next != NULL) { ofEnableDepthTest(); ofPushMatrix(); ofSetColor(255); ofTranslate(bounds.getX(), bounds.getY()); curr->drawSubsection(0, 0, bounds.getWidth(), bounds.getHeight(), 0, 0); // cout<<bounds.getWidth()<<endl; ofPopMatrix(); ofDisableDepthTest(); } else { ofLogWarning("Panel::display()", "one of more of your images have not been set"); } } }
//-------------------------------------------------------------- void meshFromONIVideo::draw() { ofBackground(0,0,0); gui.draw(); //Muevo el la visión global ofTranslate(gvtransx, gvtransy); ofRotateX(gvrotx); ofRotateY(gvroty); ofRotateZ(gvrotz); //Dibujo el eje 3D ofSetColor(255,0,0,127); // utils3d->ofDrawArrow(ofVec3f(0,0,0), ofVec3f(0,0,50), 10); // ofSetColor(0,255,0,127); // utils3d->ofDrawArrow(ofVec3f(0,0,0), ofVec3f(0,50,0), 10); // ofSetColor(0,0,255,127); // utils3d->ofDrawArrow(ofVec3f(0,0,0), ofVec3f(50,0,0), 10); utils3d->ofDrawAxis(50); utils3d->ofDrawGridPlane(300, 5, true); ofScale(.4, .4, .4); //Dibujo el mesh vbo.draw(GL_POINTS, 0,640*480*numONIFiles); }
void StFftRibbon::draw(){ app->drawFbo->fbo.begin(); ofDisableAlphaBlending(); ofClear(0,0,0); cam.begin(); glEnable(GL_DEPTH_TEST); //ofEnableBlendMode(OF_BLENDMODE_ADD); ofEnableBlendMode(OF_BLENDMODE_ALPHA); ofPushMatrix(); ofScale(1.0, 1.0, 1.0); ofRotateX(ofGetElapsedTimef() * 1.1); ofRotateY(ofGetElapsedTimef() * 1.3); ofRotateZ(ofGetElapsedTimef() * 1.2); //ofNoFill(); for (int i=0; i < fft_size-2; i+=2) { ribbons[i]->draw(); } //ofFill(); ofPopMatrix(); glDisable(GL_DEPTH_TEST); //ofEnableBlendMode(OF_BLENDMODE_ADD); ofDisableAlphaBlending(); cam.end(); app->drawFbo->fbo.end(); gui->setVisible(getSharedData().guiVisible); }
//-------------------------------------------------------------- void Sphere::draw(){ ofPushStyle(); ofSetColor(color, 255 - (255*pct)); ofPushMatrix(); ofTranslate(xPos, yPos); ofRotateX(xRot); ofRotateY(yRot); ofRotateZ(zRot); for (int j = 0; j<numParticles; j++){ ofPushMatrix(); ofRotateY(theta*j); for(int i=0; i<numParticles; i++){ //ofTranslate(currentR*cos((360/numParticles)*i), currentR*sin((360/numParticles)*i)); ofEllipse(currentR*cos((theta*i)*(PI/180)), currentR*sin((theta*i)*(PI/180)), radius, radius); //how could I get these disks to face the camera despite being in their rotated position? //ofRect(currentR*cos((theta*i)*(PI/180)), currentR*sin((theta*i)*(PI/180)), radius, radius); // cout << << endl; } ofPopMatrix(); } ofPopMatrix(); ofPopStyle(); }
void SvgVisual::draw() { ofPushMatrix(); ofTranslate(m_position); ofScale(m_scale.x, m_scale.y); if(m_centred){ ofTranslate(-m_width*0.5,-m_height*0.5); } ofRotateX(m_rotation.x); ofRotateY(m_rotation.y); //ofRect(0,0,m_width,m_height); ofScale(m_resizer.x,m_resizer.y); ofSetColor(m_color); m_svg->draw(); ofPopMatrix(); }
void ImageSynth::draw(){ if (inputImage.getWidth() > 0) { ofPushMatrix(); { ofTranslate(pos); ofRotateX(rot.x); ofRotateY(rot.y); ofRotateZ(rot.z); rot += rotSpeed; ofScale(1.0, 1.0, zscale); if (pressed) { ofSetColor(255, 12); } else { ofSetColor(255, 190); } inputImage.getTexture().bind(); mesh.draw(); inputImage.getTexture().unbind(); ofSetColor(255); float x = (ofGetFrameNum() - startFrame) % int(inputImage.getWidth()) - inputImage.getWidth()/2.0; ofDrawLine(x, -inputImage.getHeight()*1000, x, inputImage.getHeight()*1000); } ofPopMatrix(); } }
void testApp::pivot(ofVec3f center, float aX, float aY, float aZ){ ofTranslate(center); ofRotateX(aX); ofRotateY(aY); ofRotateZ(aZ); ofTranslate(-center); }
//-------------------------------------------------------------- void testApp::drawInitScene(){ // ofDrawGrid(1000.0f, 8.0f, true, true, true, true); ofEnableDepthTest(); tvroom.drawFaces(); light.enable(); light.setPosition(0, 0, tv_z + 50); light.draw(); tv.setScale(ofMap(tv_z, -1000, 0, 0.1, 1), ofMap(tv_z, -1000, 0, 0.1, 1), ofMap(tv_z, -1000, 0, 0.1, 1)); ofTranslate(tv_x, tv_y,tv_z); // tv.setPosition(tv_x, tv_y, tv_z); tv.drawFaces(); ofScale(image_scale * ofMap(tv_z, -1000, 0, 0.1, 1), image_scale * ofMap(tv_z, -1000, 0, 0.1, 1),image_scale * ofMap(tv_z, -1000, 0, 0.1, 1)); ofRotateX(180); ofTranslate(image_x, image_y, image_z); tvScreen.draw(0, 0); light.disable(); }
//-------------------------------------------------------------- void testApp::draw(){ ofBackground(0); cam.begin(); ofFill(); ofDrawAxis(1000); ofPushMatrix(); ofRotateY(receivedRotation.y); ofRotateX(receivedRotation.x); ofTranslate(-model.getPosition().x,-model.getPosition().y-model.getPosition().y/4,model.getPosition().z/2); //ofTranslate( receivedPosition.y*y_conversion,receivedPosition.x*x_conversion, 0); model.drawFaces(); model.setScale(scaling_factor,scaling_factor,scaling_factor); ofPopMatrix(); cam.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(){ ofBackgroundGradient(ofColor::white, ofColor::black); glEnable(GL_DEPTH_TEST); ofPushMatrix(); { ofTranslate((ofGetWidth()/2.0)-(bb.getWidth()/2.0), ofGetHeight()/2.0); ofRotateX(ofGetFrameNum() * 3); ofTranslate(0, -50); for(int i=0; i<letters.size(); i++) { ofSetColor(200, 0, 100); letters[i].front.draw(); ofSetColor(50, 100, 100); letters[i].back.draw(); if(bDrawWireframe) { ofSetColor(0); letters[i].front.drawWireframe(); letters[i].back.drawWireframe(); } } } ofPopMatrix(); glDisable(GL_DEPTH_TEST); }
void ofApp::drawScene(int side){ ofEnableAlphaBlending(); ofPushMatrix(); ofRotateX(90); ofRotateZ(180); ofTranslate(0, -75, 0); if(side == 0){ //left ofDrawBox(0,0,0, 90); } else{ //right ofDrawBox(0,0,0, 90); } ofPopMatrix(); ofDisableAlphaBlending(); //glDisable(GL_CULL_FACE); }
void TestScene::draw(int _surfaceId) { ofBackground(0); // A scene can draw to multiple surfaces light.enable(); //light.draw(); ofSetColor(255,255,255); ofPushMatrix(); ofRotateX(ofGetElapsedTimef()*10); ofRotateY(ofGetElapsedTimef()*10); ofRotateZ(ofGetElapsedTimef()*10); ofFill(); //ofDrawGridPlane(0.8); ofDrawBox(0,0,0,0.5,0.5,0.5); //ofDrawCone(0, 0, 0, 2, 4); //ofDrawSphere(0, 0, 0.25); //ofDrawIcoSphere(0, 0, 0, 0.5); //ofDrawPlane(0, 0, 0, 0.5, 0.5); ofPopMatrix(); light.disable(); }
//-------------------------------------------------------------- void testApp::draw() { light.setPosition(ofVec3f(0, 20, 0)); light.enable(); light.draw(); glPushMatrix(); //glTranslatef(ofGetWidth()/2, (ofGetHeight()/2), 0); glTranslatef(ofGetWidth()/2, (ofGetHeight()/2)+100, 40); glScalef(SCALE, SCALE, SCALE); ofRotateX(ofGetMouseY()); ofRotateY(ofGetMouseX()); //ofDrawAxis(200); bullet.draw(); ofSetColor(255, 255, 255); bullet.drawFloor(); glPopMatrix(); ofSetColor(255, 0, 0); ofSetWindowTitle(ofToString(ofGetFrameRate(), 1)); }
void _Line::draw(ofColor _color) { ofPushMatrix(); ofTranslate(this->x, this->y, this->z); ofRotateX(this->xRotation); ofRotateY(this->yRotation); ofRotateZ(this->zRotation); int oldWidth = 1; ofSetLineWidth(this->lineWidth); ofSetColor(_color); int x = this->point2.x - this->point1.x; int y = this->point2.y - this->point1.y; int z = this->point2.z - this->point1.z; ofDrawLine(ofPoint(0,0,0), ofPoint(x,y,z)); if (this->selected) ofSetColor(ofColor::red); else ofSetColor(ofColor::blue); ofDrawSphere(0, 0, 0, 3); ofDrawSphere(x, y, z, 3); ofSetLineWidth(oldWidth); ofPopMatrix(); }
void Car::display() { float graden = ofRadToDeg(atan2(-Velocity.y,-Velocity.x)); cout << graden << endl; ofPushMatrix(); ofTranslate(Location.x,Location.y); ofRotateZ(graden); ofRotateX(graden); cout << graden << endl; ofSetColor(170,0,168); ofRect(0,0,radius,radius-20); ofRect(15,-15,radius-15,radius-15); ofSetColor(2,128,173); ofRect(18,-13,radius-20,radius-20); ofSetColor(0); ofEllipse(38,20,radius-30,radius-30); ofEllipse(3,20,radius-30,radius-30); ofSetColor(255,218,3); ofEllipse(6,7,radius-30,radius-30); ofPopMatrix(); }
void Particle::draw(){ ofTranslate(ofGetWidth()/2, ofGetHeight()/2); for (int i=0; i<7; i++) { ofSetColor(ofRandom(0, 255), ofRandom(100, 255), ofRandom(100, 255), 255); for (int i=0; i<7; i++) { for (int i=0; i<7; i++) { ofRotateX(rotationX); ofRotateY(rotationY); ofRotateZ(rotationZ); diamond(center2, rotationX, rotationY); } } } }
//-------------------------------------------------------------- void testApp::draw(){ ofPushMatrix(); if(doShader) { shader.begin(); // set thickness of ribbons shader.setUniform1f("thickness", 20); // make light direction slowly rotate shader.setUniform3f("lightDir", sin(ofGetElapsedTimef()/10), cos(ofGetElapsedTimef()/10), 0); } glColor3f(1, 1, 1); ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2, 0); ofRotateX(mouseY); ofRotateY(mouseX); for(unsigned int i=1; i<points.size(); i++) { ofLine(points[i-1], points[i]); } if(doShader) shader.end(); ofPopMatrix(); ofDrawBitmapString("fps: " + ofToString((int)ofGetFrameRate()) + "\nPress 's' to toggle shader: " + (doShader ? "ON" : "OFF"), 20, 20); }
void ofApp::draw() { gui.draw(); // verplaats het 0-punt naar 't midden van 't scherm ofTranslate(ofGetWidth()/2, ofGetHeight()/2); // draai het grid om de x-as ofRotateX(rotationX); ofSetColor(255,0,0); ofCircle(-300,0,130); // draai het grid om de y-as ofRotateY(rotationY); ofSetColor(0,255,0); ofCircle(0,0,130); // draai het grid om de z-as ofRotateZ(rotationZ); ofSetColor(0,0,255); ofCircle(300,0,130); // als het 'drawGrid' vlaggetje op 'true' staat, teken dan 't grid if (drawGrid) ofDrawGrid(200); }
//-------------------------------------------------------------- void ofApp::draw(){ float gridsize = 500; cam.begin(); ofDrawGrid(gridsize/2.0, 8.0f, false, false, false, true); ofPushMatrix(); ofMultMatrix(tabmtx); ofDrawAxis(30); ofEnableLighting(); light.enable(); ofPushMatrix(); ofRotateX(90); ofDrawCylinder(0,52,0,3,100); ofPopMatrix(); // you can also get global tablet data at any time TabletData& data = ofxTablet::tabletData; float p= data.pressure*25; if (p<10) p = 10; ofDrawArrow(ofVec3f(0,0,100), ofVec3f(0,0,0), p); ofDisableLighting(); ofPopMatrix(); cam.end(); }
//-------------------------------------------------------------- void testApp::draw() { light.setPosition(ofVec3f(0, 20, 0)); light.enable(); light.draw(); glEnable(GL_DEPTH_TEST); glPushMatrix(); glTranslatef(ofGetWidth()/2, (ofGetHeight()/2), 40); glScalef(SCALE, SCALE, SCALE); ofRotateX(90);//ofGetMouseY()); //ofRotateY(90);//ofGetMouseX()); bullet.draw(); ofSetColor(255, 255, 255); bullet.drawFloor(); glPopMatrix(); glDisable(GL_BLEND); glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); glColor4f(1, 1, 1, 1); ofDrawBitmapString( "space: add random sphere | x: clear attractions | z: add attractions", 20, 15); ofSetColor(255, 0, 0); ofSetWindowTitle(ofToString(ofGetFrameRate(), 1)); }
void FFTFnwrNoise::draw(){ float br = 2.5; float pow = powf(((testApp*)ofGetAppPtr())->avg_power, 0.9) * 10.0; int skip = pow/4.0 + 2; ofRotateX(180); //ofScale(pow/100+1.2,pow/100+1.2); ofScale(1.2,1.2); ofTranslate(-fnwr.width/2, -fnwr.height/2); //ofSetRectMode(OF_RECTMODE_CENTER); ofEnableBlendMode(OF_BLENDMODE_ADD); //ofEnableBlendMode(OF_BLENDMODE_ALPHA); for (int i = 0; i < fnwr.width; i+=skip) { for (int j = 0; j < fnwr.height; j+=skip) { int r = pixels[j * fnwr.width * 3 + i * 3] * br; int g = pixels[j * fnwr.width * 3 + i * 3 + 1]* br; int b = pixels[j * fnwr.width * 3 + i * 3 + 2]* br; ofSetColor(r, 0, 0); ofRect(i, int(j - magnitude[i] * pow / 4.0), skip, skip); ofSetColor(0, g, 0); ofRect(i, j, skip, skip); ofSetColor(0, 0, b); ofRect(i, int(j + magnitude[fft_size - i] * pow / 4.0), skip, skip); } } //ofSetRectMode(OF_RECTMODE_CORNER); ofEnableBlendMode(OF_BLENDMODE_ALPHA); ofDisableLighting(); ofSetColor(120,120,120,255-pow*3); fnwr.draw(0, 0); ofEnableLighting(); ofEnableBlendMode(OF_BLENDMODE_ADD); }
void FFTTracer::draw(){ glEnable(GL_DEPTH_TEST); //ofEnableBlendMode(OF_BLENDMODE_ALPHA); ofDisableLighting(); ofPushMatrix(); ofScale(1.0, 1.0, 1.0); ofRotateX(ofGetElapsedTimef() * 4); ofRotateY(ofGetElapsedTimef() * 3); ofRotateZ(ofGetElapsedTimef() * 2); for (int i=0; i<fft_size; i++) { if(magnitude[i] > 1){ ofSetColor(ofColor::fromHsb(255 * i / fft_size, 200, 120)); float w = powf(((testApp*)ofGetAppPtr())->power[i],4.0); if (w > 10) { w = 10; } ofSetLineWidth(w); trackers[i]->draw(); } } ofPopMatrix(); ofEnableLighting(); glDisable(GL_DEPTH_TEST); //ofEnableBlendMode(OF_BLENDMODE_ADD); }