Exemple #1
0
 void OgreNode::update()
 {
   if (mDirtyFBO) {
     activateOgreContext();
     updateFBO();
     mOgreFboId = getOgreFboId();
     mDirtyFBO = false;
     doneOgreContext();
   }
 }
void imageGrid::draw(float x, float y) {

//    ofSetColor(255, 0, 0);
//    ofFill();
//    ofRect(x,y, 1000, 1000);

    ofSetColor(255);
    //portrait_grid.draw(x,y);
    updateFBO();
}
void MapNode::update()
{
    restoreRenderState();

    if (!m_initialized)
        init();

    if (m_dirtyFBO)
        updateFBO();

    saveRenderState();
}
void imageGrid::update() {

    if(old_grid_cols != grid_cols || old_grid_rows != grid_rows) {
        old_grid_cols = grid_cols;
        old_grid_rows = grid_rows;
        updateFBO();
    }
    if(old_portraitFont_y != portraitFont_y) {
        old_portraitFont_y = portraitFont_y;
        updateFBO();
    }
    if(old_portraitFont_lineHeight != portraitFont_lineHeight) {
        old_portraitFont_lineHeight = portraitFont_lineHeight;
        updateFBO();
    }
    /*
    if(old_portraitFrame_top != portraitFrame_top){
        portraitFrame_top = ofClamp(portraitFrame_top, 0, portrait_height/3);
        old_portraitFrame_top = portraitFrame_top;
        updateFBO();
    }
    if(old_portraitFrame_bottom != portraitFrame_bottom){
         portraitFrame_bottom = ofClamp(portraitFrame_bottom, portrait_height/3.0*2.0, portrait_height);
        old_portraitFrame_bottom = portraitFrame_bottom;
        updateFBO();
    }
    if(old_portraitFrame_left != portraitFrame_left){
        portraitFrame_left = ofClamp(portraitFrame_left, 0, portrait_width/3);
        old_portraitFrame_left = portraitFrame_left;
        updateFBO();
    }
    if(old_portraitFrame_right != portraitFrame_right){
          portraitFrame_right = ofClamp(portraitFrame_right,portrait_width/3*2,portrait_width);
        old_portraitFrame_right = portraitFrame_right;
        updateFBO();
    }
    */
    if(old_portrait_fontSize != portrait_fontSize) {
        old_portrait_fontSize = portrait_fontSize;
        portrait_gridFont.setSize(portrait_fontSize);
        updateFBO();
    }
    if(old_portrait_fontSizeSmall != portrait_fontSizeSmall) {
        old_portrait_fontSizeSmall = portrait_fontSizeSmall;
        portrait_gridFontSmall.setSize(portrait_fontSizeSmall);
        updateFBO();
    }
    if(old_portraitFont_ySmall != portraitFont_ySmall) {
        old_portraitFont_ySmall = portraitFont_ySmall;
    }
    if(old_portraitFont_lineHeightSmall != portraitFont_lineHeightSmall) {
        old_portraitFont_lineHeightSmall = portraitFont_lineHeightSmall;
    }
    if(old_bDrawExtras != bDrawExtras) {
        old_bDrawExtras = bDrawExtras;
        updateFBO();
    }

}
 void 
 MusicRenderer::DrawQuad(const GlobalState& global, const StateCache& state, const QuadInfo& quad, 
                                const Texture& image, const MultitextureMap& multitexture, const GLShaderState* shaderState)
 {
     // no music data --> NOP
     if (!_isMusicDataValid)
     {
         QuadRendererES2::DrawQuad(global, state, quad, image, multitexture, shaderState);
         return;
     }
     
     //--------------------------------------------------------------------------
     // store / reset opengl state to prepare for rendering
     //--------------------------------------------------------------------------
     
     // store the framebuffer ID we're being called inside
     ScreenState screenState;
     screenState.store();
     
     //--------------------------------------------------------------------------
     // start our algorithm with these inputs
     //--------------------------------------------------------------------------
     updateFBO(state, image.textureID, image.width, image.height);
     
     //--------------------------------------------------------------------------
     // restore the opengl state we've reset before returning control 
     //--------------------------------------------------------------------------
     
     glActiveTexture(GL_TEXTURE0); // politely set the active texture to 0
     glBindTexture(GL_TEXTURE_2D, 0);
     
     screenState.restore();
     
     //--------------------------------------------------------------------------
     // setup to use base QuadRendererES2 to draw out texture
     //--------------------------------------------------------------------------
     
     // using _finalOutputFBO and pass that to the quad drawing code
     Texture t   = image;
     t.textureID = _fbo.colorTextureID();
     
     // draw
     QuadRendererES2::DrawQuad(global, state, quad, t, multitexture, shaderState);
 }
Exemple #6
0
//--------------------------------------------------------------
void gamuzaMain::update(){

    char temp_message[512];

	//////////////////////////////////////////////
	// INIT PROGRAM | splash image control
	if(ofGetElapsedTimeMillis() > splashWait){
		splashFinish = true;
		if(flagSystemLoaded){
			flagSystemLoaded = false;
            sprintf(temp_message,"OpenGL version: %s", glGetString (GL_VERSION));
            sendPrivateMessage(GAMUZA_CONSOLE_LOG, temp_message);
            sendPrivateMessage(GAMUZA_CONSOLE_LOG, " ");
            if(GL_ARB_shader_objects){
                sprintf(temp_message,"GL_ARB_shader SUPPORTED by your Graphic Card: %s", glGetString (GL_RENDERER));
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, temp_message);
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, " ");
            }else{
                sprintf(temp_message,"GL_ARB_shader NOT SUPPORTED by your Graphic Card: %s", glGetString (GL_RENDERER));
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, temp_message);
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, "switching to SHADER OFF MODE");
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, " ");
            }

			if(audioActivated){
				soundStream.start();
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, "soundStream STARTED");
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, " ");
				for(unsigned int i = 0; i < audioInputChannels; i++){
					inputAudioCH[i].computeChannel = true;
				}
				computeAudioInput	= true;
				computeAudioOutput	= true;

			}
            if(arduinoActivated){
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, "ARDUINO connection established");
                sendPrivateMessage(GAMUZA_CONSOLE_LOG, " ");
            }
		}
		//////////////////////////////////////////////
		// Main settings control
		ofSetVerticalSync(useVSync);
		//////////////////////////////////////////////

		//////////////////////////////////////////////
		// GUI update
		updateGui();
		gui.update();
		//////////////////////////////////////////////

        //////////////////////////////////////////////
		// FBO Output Texture update
        updateFBO();
        //////////////////////////////////////////////

		//////////////////////////////////////////////
		// OPENNI
		if(openniActivated && sensorKinect.useKinect && sensorKinect.isOniConnected){
			sensorKinect.updateDevice();
		}
		//////////////////////////////////////////////

		//////////////////////////////////////////////
		// WEBCAM input devices update
		if(trackingActivated){
			for(unsigned int i=0;i<numCamInputs;i++){
				if(inputCam[i].captureVideo){
					inputCam[i].update();
				}
			}
		}
		//////////////////////////////////////////////

		//////////////////////////////////////////////
		// ARDUINO update
		if(arduinoActivated && useArduino){
			updateArduino();
		}
		//////////////////////////////////////////////

	}
	//////////////////////////////////////////////

    //////////////////////////////////////////////
    // OSC update
    updateOSC();
    // OSC messages receiving
    receiveOSC();
    //////////////////////////////////////////////

	//////////////////////////////////////////////
	// SYSTEM
	gamuzaRealFPS = ofGetFrameRate();
    gaFrameCounter++;
	//////////////////////////////////////////////

}