Exemplo n.º 1
0
void testApp :: toggleFullScreen()
{
	ofToggleFullscreen();
	
	if( ofGetWindowMode() == OF_WINDOW )
	{
		renderArea.x		= renderAreaWindow.x;
		renderArea.y		= renderAreaWindow.y;
		renderArea.width	= renderAreaWindow.width;
		renderArea.height	= renderAreaWindow.height;
	}
	
	if( ofGetWindowMode() == OF_FULLSCREEN )
	{
		renderArea.x		= renderAreaFullScreen.x;
		renderArea.y		= renderAreaFullScreen.y;
		renderArea.width	= renderAreaFullScreen.width;
		renderArea.height	= renderAreaFullScreen.height;
	}
	
	screenGrabUtil.setArea( &renderArea );
	
	if( julApp != NULL )
		julApp->setRenderArea( renderArea.x, renderArea.y, renderArea.width, renderArea.height );
}
Exemplo n.º 2
0
Workspace::Workspace() {
    // create log viewers for each REPL
    replLog = new ReplLog(repl);
    screplLog = new ReplLog(screpl);

    createEditor(repl);
    createEditor(screpl);

#ifdef SPLIT_SCREEN
    // 3rd editor for split screen
    Editor* ed = createEditor();
    subThread.setEditor(ed);
    subThread.startThread(true);
#endif

    repl.start("data/tidalStartup.hss");
    screpl.start("data/scStartup.scd");

    currentEditor = 0;
    showReplBuffer = true;

    // force resize to position editors
    int w = (ofGetWindowMode() == OF_WINDOW) ? ofGetViewportWidth() : ofGetScreenWidth();
    int h = (ofGetWindowMode() == OF_WINDOW) ? ofGetViewportHeight() : ofGetScreenHeight();
    resize(w, h);
}
Exemplo n.º 3
0
void ofxGLEditor::reShape() {

	int w = (ofGetWindowMode() == OF_WINDOW)?ofGetWidth():ofGetScreenWidth();
	int h = (ofGetWindowMode() == OF_WINDOW)?ofGetHeight():ofGetScreenHeight();
	for (int i = 0; i < glEditor.size(); i++) {
		glEditor[i]->Reshape(w*1.2, h);
	}

}
Exemplo n.º 4
0
//--------------------------------------------------------------
void MotionTracker::keyPressed  (int key){ 
	switch (key){
		case 't':if(ofGetWindowMode() == OF_WINDOW) vidGrabber.videoSettings();
			break;
		case 's':
			bLearnBG = true;
			break;
	}
}
Exemplo n.º 5
0
void testApp::keyPressed(int key){
    if (key == 'f') {
        // No fullscreen
        if (ofGetWindowMode() == 0) {
            ofSetFullscreen(true);
        } else {
            ofSetFullscreen(false);
        }
    }
}
Exemplo n.º 6
0
//--------------------------------------------------------------
void ofxMtlMapping2DControls::windowResized()
{
    if (ofGetWindowMode() == OF_FULLSCREEN) {
        ((ofxUIImageToggle *)_toolsCanvas->getWidget(kSettingMappingFullscreen))->setImage(&_fullscreenContractIcon);
    } else {
        ((ofxUIImageToggle *)_toolsCanvas->getWidget(kSettingMappingFullscreen))->setImage(&_fullscreenExpandIcon);
    }
    
    _toolsCanvas->setHeight(720);
    _gridSettingsCanvas->setPosition(_toolsCanvas->getRect()->width, 720 - 90);
}
Exemplo n.º 7
0
void imageLoader::chooseDir(){
    if(ofGetWindowMode() == 0){
        ofBackground(0);
        ofFileDialogResult result = ofSystemLoadDialog("Folder To Watch...", true);
        if(result.bSuccess) {
            path = result.getPath();
           // img01   = 0;
            //img02   = 1;
           // alpha01 = 255;
            //alpha02 = 0;
            loadDir();
            //cout << "path:  " << path << endl;
        }
    }else {
    help = true;
    }
}
Exemplo n.º 8
0
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
	if( key == 'f' ){
		int mode = ofGetWindowMode();

		if (mode == OF_WINDOW) {
		    ofSetFullscreen(1);
		} else if (mode == OF_FULLSCREEN){
			ofSetFullscreen(0);
		}
	}

	if( key == '1' ){
		toggle0 = !toggle0;
	}
	if( key == '2'){
		toggle1 = !toggle1;
	}
	if( key == '3' ){
		toggle2 = !toggle2;
	}
}
Exemplo n.º 9
0
//--------------------------------------------------------------
void testApp::keyPressed  (int key){
//    cout << "key pressed ("<<key<<")\n";
    switch (key) {
        case 'f':
            {
                if (ofGetWindowMode()==OF_FULLSCREEN){
                    ofSetWindowShape(1024,768);
                    ofSetFullscreen(false);
                    op1.setDimensions(1024/2, 768/2, 1024-200);
                }else{
                    ofSetWindowShape(ofGetScreenWidth(),ofGetScreenHeight());
                    ofSetFullscreen(true);
                    op1.setDimensions(ofGetScreenWidth()/2, ofGetScreenHeight()/2, ofGetScreenWidth()-200);
                }
            }
            break;
            
        default:
            break;
    }
}
Exemplo n.º 10
0
void liveApp::keyPressed  (int key)	{
	if ( key == 'm')	ofHideCursor();
	if ( key == 'M')	ofShowCursor();
	if ( key == 'g')	{
		for (int t = 0; t < 1; t++)	{
			int x1i = int(ofRandom(0,63));
			int x1j = int(ofRandom(0,63));			
			int x2i = int(ofRandom(0,63));			
			int x2j = int(ofRandom(0,63));			
			int y1i = int(ofRandom(0,63));			
			int y1j = int(ofRandom(0,63));			
			int y2i = int(ofRandom(0,63));																		
			int y2j = int(ofRandom(0,63));						
			//SetColor(citrusColor[int(ofRandom(0,11))]);									
			ofSetColor(255,255,255,255);												
			myFont11.drawString("0",gridX[x1i][x1j], gridY[y1i][y1j]);							
			myFont11.drawString("1",gridX[x2i][x2j], gridY[y2i][y2j]);	
			ofSetColor(255,255,255,12);
			//ofCurve(0,0, gridX[x1i][x1j], gridY[y1i][y1j], gridX[x2i][x2j], gridY[y2i][y2j], 1000,1000);						
			ofLine(gridX[x1i][x1j], gridY[y1i][y1j], gridX[x2i][x2j], gridY[y2i][y2j]);									
		}
	}	
	if ( key == 'G')	{
	    glPushMatrix();
        glTranslatef(ofGetWidth()/2,ofGetHeight()/2,0);
		gluLookAt(2*mouseX, 2*mouseY, 2*mouseX, // eyeX, eyeY, eyeZ
         0.0, 0.0, 0.0, // centerX, centerY, centerZ
         0.0, 1.0, 0.0);				
        glRotatef(-2*mouseY,1,0,0);
        glRotatef(2*mouseX,0,1,0);
		ofSetColor(255,255,255,255);
		glBegin(GL_POINTS);	//GL_POINTS,GL_LINE_LOOP, GL_LINE_STRIP  (http://pyopengl.sourceforge.net/documentation/manual/glBegin.3G.xml)
		for (int i = 0; i < MAX_MATRIX; i++)	{
			for (int j = 0; j < MAX_MATRIX; j++)	{			
				for (int k = 0; k < MAX_MATRIX; k++)	{	
					//ofPoint()
					matrix3d.x = gridX3d[i][j][k];
					matrix3d.y = gridY3d[i][j][k];
					matrix3d.z = gridZ3d[i][j][k];
					glVertex3i(matrix3d.x, matrix3d.y, matrix3d.z);		
				}
			}
		}
		glEnd();	
		glPopMatrix();
	}	
	if(key == 'f' or key == 'F'){
		int previousWindowX, previousWindowY;  
		
		if(ofGetWindowMode() == 0){  

			ofSetFullscreen(true);
			ofBackground(0, 0, 0);
		}else{  
			ofSetFullscreen(false);
			ofBackground(0, 0, 0);
		}  
	}		
	if(key == 'b' or key == 'B'){
		ofBackground(0, 0, 0);
	}	
	if(key == 't' or key == 'T'){
		//ofBackground(0,0,0);
        glTranslatef(ofGetWidth()/2,ofGetHeight(),0);	
		seed1(dotSize, (270*3.1415926)/180, 0, 0);
	}	
	if(key == 'p') {
			slowMotion = !slowMotion;
			if(slowMotion)
					timeStep = .05;
			else
					timeStep = 1;
	}
}
Exemplo n.º 11
0
void liveApp::setup()	{
	{

		ofBackground(0,0,0);

		int windowMode = ofGetWindowMode();  
		if(windowMode == OF_FULLSCREEN){  
			this->windowWidth = ofGetScreenWidth();  
			this->windowHeight = ofGetScreenHeight();  
		}  
		else if(windowMode == OF_WINDOW){  
			this->windowWidth = ofGetScreenWidth();  
			this->windowHeight = ofGetScreenHeight();  
		} 
		
		//ofSetCircleResolution(200);
		texScreen.allocate(ofGetWidth(), ofGetHeight(),GL_RGB);// GL_RGBA); 
		ofSetBackgroundAuto(false);
		ofEnableSmoothing();
		ofEnableAlphaBlending(); 
		//glutSetCursor(GLUT_CURSOR_CYCLE);  // change cursor icon (http://pyopengl.sourceforge.net/documentation/manual/glutSetCursor.3GLUT.html)
		cout << "recieving OSC at port: 12345 " << PORTlisten << "\n";
		receiver.setup( PORTlisten );
		current_msg_string = 0;
				
		ofSetWindowTitle("Rhythmanalysis");
		ofSetFrameRate(60); // if vertical sync is off, we can go a bit fast... this caps the framerate at 60fps.
		ofSetVerticalSync(false);
		
		
	}	// Setup
	{
	memAlloc = true;
	float cellX = 0, cellY = 0;
	for (int i = 0; i < MAX_MATRIX; i++)	{
		for (int j = 0; j < MAX_MATRIX; j++)	{			
			gridX[i][j] = cellX; 
			gridY[i][j] = cellY;
			cellX = cellX + 20;
		}
		cellX = 0;
		cellY = cellY + 20;
	}
	float cellX3d = 0, cellY3d = 0, cellZ3d = 0;
	for (int i = 0; i < MAX_MATRIX; i++)	{
		for (int j = 0; j < MAX_MATRIX; j++)	{			
			for (int k = 0; k < MAX_MATRIX; k++)	{					
				gridX3d[i][j][k] = cellX3d; 
				gridY3d[i][j][k] = cellY3d;
				gridZ3d[i][j][k] = cellZ3d;				
				cellX3d = cellX3d + 40;
			}
			cellX3d = 0;
			cellY3d = cellY3d + 40;
		}
		//cellX3d = 0;
		cellY3d = 0;		
		cellZ3d = cellZ3d + 40;
	}
	}	// memAlloc
	{
		//video
		videoX=videoY=0;
		
		//destruct
		destruct = 0;
		destructCase = 1;
		
		//camera
		camera=false;
		
		//superformula
		superformula = false;
		
		//sketch
		aSound = 5;
		rSketch = gSketch = bSketch = aSketch = 255;
		 		
		// Tree
		dotSize = 15;
		angleOffsetA = (1.5*3.14)/180; // Convert 1.5 degrees to radians
		angleOffsetB = (50*3.14)/180;  // Convert 50 degrees to radians
		
		//background
		aBack = 0;
		view_fillBackground = 1;
		
		//sound
		viewSoundChanels = 1;
		
		drawWithMouse = 0;
		numMouseSketches = 99;
		minMouseElasticity = 0.0;
		maxMouseElasticity = 0.99;
		minMouseDamping = 0.0;
		maxMouseDamping = 0.99;
		
		numSoundSketches = 99;
		minSoundElasticity = 0.0;
		maxSoundElasticity = 0.99;
		minSoundDamping = 0.0;
		maxSoundDamping = 0.99;
		
		mouseLines = 1;
		soundLines = 0;
		
		ampInLow =0.0;
		ampInHigh = 0.15;
		freqInLow = 20;
		freqInHigh = 4000;
		
		feedbackView = 0;
		feedbackSpeedX = 0;
		feedbackSpeedY = 0;
		timeLine = 0;
		viewRotate = 0;				
			
		}	// Initial Values
	{
		// Imagenes
		// GROUP 1
		string imageDir = "/Users/ari/Media/images/paintings/lyon/";
		
		for (int i = 0; i < 61; i++)	{
			string number;
			std::string s;
			std::stringstream out;
			out << i;
			s = out.str();
			imageDir += s;
			imageDir += ".jpg";
			cout << imageDir << endl;
			image[i].loadImage(imageDir);
			imageDir = "/Users/ari/Media/images/paintings/lyon/";
		}

		// GROUP 2
		imageDir = "/Users/ari/Media/images/maps/google/grenoble/";
		
		for (int i = 0; i < 10; i++)	{
			string number;
			std::string s;
			std::stringstream out;
			out << i;
			s = out.str();
			imageDir += s;
			imageDir += ".png";
			cout << imageDir << endl;
			image[100+i].loadImage(imageDir);
			imageDir = "/Users/ari/Media/images/maps/google/grenoble/";
		}
		
		// Video
		myVideo = new ofVideoPlayer();
		playVideo = 0;
		rVideo = gVideo = bVideo = aVideo = 255;
		
		//===================================
		
		// Fonts
		myFont11.loadFont("/Users/ari/Media/fonts/favorites/Batang.ttf", 11, true, true, true);
		myFont350.loadFont("/Users/ari/Media/fonts/favorites/Batang.ttf", 350, true, true, true);		
	}	// data (images, fonts, video ...)
 	{
		for (int i = 0; i < MAX_SKETCHES; i++){
			sketch[i].init(0, ofRandom(minSoundElasticity, maxSoundElasticity), ofRandom(minSoundDamping, maxSoundDamping));	//to 1o stoixeio einai to id 0:
			sketch[i].init(1, ofRandom(minMouseElasticity, maxMouseElasticity), ofRandom(minMouseDamping, maxMouseDamping));	//id:1 => mouse init(int sketchID, float elast, float aposv)
		}
		
		sketchPhrase = false;

	}	// sKeTch
	{
		playSpectro = 0;
		rSound = gSound = bSound = 255; aSound = 25;
		textureRed = textureGreen = textureBlue = textureAlpha = 255;
		reverseEllipse = ofGetWidth();	reverseTexture = -1;
		mirrorMode = 9;
		spectroRed = spectroGreen = spectroBlue = 1;	
		
		
		soundEffectNoto = false;
	}	// Sound Interaction
	{
        // this number describes how many bins are used
        // on my machine, 2 is the ideal number (2^2 = 4x4 pixel bins)
        // if this number is too high, binning is not effective
        // because the screen is not subdivided enough. if
        // it's too low, the bins take up so much memory as to
        // become inefficient.
        int binPower = 4;

        particleSystem.setup(ofGetWidth(), ofGetHeight(), binPower);
		/*
        kParticles = 2;  // change that to 5 for MacBook Pro
        float padding = 0;
        float maxVelocity = .5;
        for(int i = 0; i < kParticles * 1024; i++) {
                float x = ofRandom(padding, ofGetWidth() - padding);
                float y = ofRandom(padding, ofGetHeight() - padding);
                float xv = ofRandom(-maxVelocity, maxVelocity);
                float yv = ofRandom(-maxVelocity, maxVelocity);
                Particle particle(x, y, xv, yv);
                particleSystem.add(particle);
        }
		 */
		rConColor=gConColor=bConColor=rDotColor=gDotColor=bDotColor=255;
        ofBackground(0, 0, 0);

        timeStep = 1;
        lineOpacity = 0;
        pointOpacity = 255;
        isMousePressed = false;
        slowMotion = false;
        particleNeighborhood = 15;
        particleRepulsion = 1;
        centerAttraction = .01;
		forceRadius = 100;
		forceScale = 10;
		bounceXstart = 0; 
		bounceYstart = 0;
		bounceXend = ofGetWidth(); 
		bounceYend = ofGetHeight();
		
		viewParticles = false;
		
		
		}	// Particles
	{
//		w = ofGetWidth();
//		h = ofGetHeight();
		w = 1280;
		h = 1024;
		
		mirrowEffect4 = false;
		texMirrow.allocate(w,h, GL_RGB);

		noiseEffect = false;
		texGray.allocate(w,h,GL_LUMINANCE);
		grayPixels			= new unsigned char [w*h];
		// gray pixels, set them randomly
		for (int i = 0; i < w*h; i++){
			grayPixels[i] = (unsigned char)(ofRandomuf() * 255);
			
		}
		texGray.loadData(grayPixels, w,h, GL_LUMINANCE); 
	}	// Texture effects
		
}
Exemplo n.º 12
0
//--------------------------------------------------------------
void ofxGLEditor::resize() {
	int w = (ofGetWindowMode() == OF_WINDOW) ? ofGetViewportWidth() : ofGetScreenWidth();
	int h = (ofGetWindowMode() == OF_WINDOW) ? ofGetViewportHeight() : ofGetScreenHeight();
	resize(w, h);
}