void SceneRenderToTex::initScene() { compileAndLinkShader(); glEnable(GL_DEPTH_TEST); plane = new VBOPlane(50.0f, 50.0f, 1, 1); cube = new VBOCube(); projection = mat4(1.0f); teapot = new VBOTeapot(14, mat4(1.0f)); angle = 0.0; setupFBO(); // One pixel white texture GLuint whiteTexHandle; GLubyte whiteTex[] = { 255, 255, 255, 255 }; glActiveTexture(GL_TEXTURE1); glGenTextures(1, &whiteTexHandle); glBindTexture(GL_TEXTURE_2D,whiteTexHandle); glTexImage2D(GL_TEXTURE_2D,0,GL_RGBA,1,1,0,GL_RGBA,GL_UNSIGNED_BYTE,whiteTex); }
bool Blur::setup(int winW, int winH, float blurAmount, int texFetches) { assert(winW); assert(winH); assert(blurAmount); assert(texFetches); win_w = winW; win_h = winH; blur_amount = blurAmount; num_fetches = texFetches; glGenVertexArrays(1, &vao); if(!setupFBO()) { shutdown(); return false; } if(!setupShader()) { shutdown(); return false; } return true; }
void DepthOfField::setup(int w, int h) { fbo_w = w; fbo_h = h; glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); setupShaders(); setupBuffers(); setupFBO(); }
void MyWindow::initialize() { CreateVertexBuffer(); initShaders(); pass1Index = mFuncs->glGetSubroutineIndex( mProgram->programId(), GL_FRAGMENT_SHADER, "pass1"); pass2Index = mFuncs->glGetSubroutineIndex( mProgram->programId(), GL_FRAGMENT_SHADER, "pass2"); pass3Index = mFuncs->glGetSubroutineIndex( mProgram->programId(), GL_FRAGMENT_SHADER, "pass3"); initMatrices(); setupFBO(); glFrontFace(GL_CCW); glEnable(GL_DEPTH_TEST); }
void SSAO::setup(int w, int h) { fbo_w = w; fbo_h = h; glEnable(GL_DEPTH_TEST); glEnable(GL_CULL_FACE); setupShaders(); setupBuffers(); setupFBO(); loadImages(); mm.identity(); mm.scale(0.8f); mm.translate(0.0f, -50.0f, 0.0f); }
void TerrainFBO::setup() { w =2048*2; h=2048*2; setupProgram(); setupFBO(); setupDrawData(); npMaterial mat; mat.loadDiffuse("3DAssets/terrainNoise.png"); textureNoise = mat.diffuseTexture; }
bool YUV420PGrabber::setup(int winW, int winH, int framerate) { if(!winW || !winH) { printf("error: invalid win_w or win_h: %dx%d\n", winW, winH); return false; } if(!framerate) { printf("error: invalid fps: %d\n", framerate); return false; } win_w = winW; win_h = winH; uv_w = vid_w * 0.5; uv_h = vid_h * 0.5; fps = framerate; if(!setupSizes()) { printf("error: cannot setup the sizes. did you add any? make sure to call addSize()\n"); return false; } if(!setupTextures()) { printf("error: cannot setup textures.\n"); return false; } #if 0 if(!setupPBO()) { printf("error: cannot setup pbox.\n"); return false; } #endif if(!setupFBO()) { printf("error: cannot setup fbo.\n"); return false; } if(!setupVAO()) { printf("error: cannot setup vao.\n"); return false; } if(!setupShaders()) { printf("error: cannot setup shaders.\n"); return false; } image = new unsigned char[tex_w * tex_h]; if(!image) { printf("error: cannot allocate image buffer.\n"); return false; } // set the pointers to the image for(std::vector<YUV420PSize>::iterator it = sizes.begin(); it != sizes.end(); ++it) { YUV420PSize& s = *it; s.planes[0] = &image[s.y_offset]; s.planes[1] = &image[s.u_offset]; s.planes[2] = &image[s.v_offset]; } frame_delay = (1.0/fps) * 1000 * 1000 * 1000; return true; }
//-------------------------------------------------------------- void gamuzaMain::setup(){ flagSystemLoaded = false; // first line of gamuza setup ////////////////////////////////////////////// // load settings from xml loadGamuzaSettings(); // automation isFullscreen = false; if(autoPilot){ gamuzaFullscreen(); } ////////////////////////////////////////////// ////////////////////////////////////////////// // init general openframeworks settings ofSetEscapeQuitsApp(false); ofSetFrameRate(200); ofEnableSmoothing(); ofSetLogLevel(OF_LOG_VERBOSE); ////////////////////////////////////////////// ////////////////////////////////////////////// // OSC data sending @ host_number(IP),host_port gamuzaSetup.lock(); setupOSC(); gamuzaSetup.unlock(); ////////////////////////////////////////////// ////////////////////////////////////////////// // AUDIO if(audioActivated){ gamuzaSetup.lock(); setupAudio(); gamuzaSetup.unlock(); } ////////////////////////////////////////////// ////////////////////////////////////////////// // MIDI gamuzaSetup.lock(); setupMidi(); gamuzaSetup.unlock(); ////////////////////////////////////////////// ////////////////////////////////////////////// // OPENNI if(openniActivated){ gamuzaSetup.lock(); sensorKinect.setupDevice(workingW,workingH,useKinectInfrared,sensorKinectLedState); gamuzaSetup.unlock(); } ////////////////////////////////////////////// ////////////////////////////////////////////// // FBO second screen output texture gamuzaSetup.lock(); setupFBO(); gamuzaSetup.unlock(); ////////////////////////////////////////////// ////////////////////////////////////////////// // ARDUINO if(arduinoActivated){ gamuzaSetup.lock(); setupArduino(); gamuzaSetup.unlock(); } ////////////////////////////////////////////// ////////////////////////////////////////////// // GUI // include setup of webcams & audio inputs gamuzaSetup.lock(); setupSettingPanel(); setupGui(); gamuzaSetup.unlock(); ////////////////////////////////////////////// ////////////////////////////////////////////// // SYSTEM currentSavedFrame = 0; gaFrameCounter = 0; ////////////////////////////////////////////// ////////////////////////////////////////////// // set log level to error only ofSetLogLevel(OF_LOG_ERROR); sendPrivateMessage(GAMUZA_CONSOLE_LOG, " "); ////////////////////////////////////////////// }
//-------------------------------------------------------------- void gamuzaMain::setup(){ flagSystemLoaded = false; // first line of gamuza setup ////////////////////////////////////////////// // load settings from xml loadGamuzaSettings(); if(START_WITH_FULLSCREEN){ isFullscreen = true; }else{ isFullscreen = false; } // automation if(autoPilot){ gamuzaFullscreen(); } ////////////////////////////////////////////// ////////////////////////////////////////////// // init general openframeworks settings ofSetFrameRate(FPS); ofEnableSmoothing(); ofSetLogLevel(OF_LOG_VERBOSE); ////////////////////////////////////////////// ////////////////////////////////////////////// // AUDIO if(audioActivated){ gamuzaSetup.lock(); setupAudio(); gamuzaSetup.unlock(); } ////////////////////////////////////////////// ////////////////////////////////////////////// // OPENNI if(openniActivated){ gamuzaSetup.lock(); sensorKinect.setupDevice(workingW,workingH,useKinectInfrared,sensorKinectLedState); gamuzaSetup.unlock(); } ////////////////////////////////////////////// ////////////////////////////////////////////// // FBO second screen output texture gamuzaSetup.lock(); setupFBO(); gamuzaSetup.unlock(); ////////////////////////////////////////////// ////////////////////////////////////////////// // OSC data sending @ host_number(IP),host_port if(oscActivated){ gamuzaSetup.lock(); setupOSC(); gamuzaSetup.unlock(); } ////////////////////////////////////////////// ////////////////////////////////////////////// // ARDUINO if(arduinoActivated){ gamuzaSetup.lock(); setupArduino(); gamuzaSetup.unlock(); } ////////////////////////////////////////////// ////////////////////////////////////////////// // GUI // include setup of webcams & audio inputs gamuzaSetup.lock(); setupGui(); gamuzaSetup.unlock(); ////////////////////////////////////////////// ////////////////////////////////////////////// // SYSTEM currentSavedFrame = 0; ////////////////////////////////////////////// ////////////////////////////////////////////// // set log level to error only ofSetLogLevel(OF_LOG_ERROR); ////////////////////////////////////////////// }