void PostProcController::endDraw(ofCamera& cam) { if (_params.enabled()) { _postProc.end(); } else { cam.end(); } }
void BlobMask::updateWith(ofCamera & camera){ for(auto & sphere: blob){ sphere.radius = ofNoise(sphere.pos.x, sphere.pos.y, sphere.pos.z, ofGetElapsedTimef() * 0.5) * this->radius; } ofEnableDepthTest(); minMaxDepthShader.begin(); minDepthFbo.begin(); minDepthFbo.clearDepthBuffer(0.f); glDepthFunc(GL_GREATER); camera.begin(); for(auto & sphere: blob){ ofDrawSphere(sphere.pos, sphere.radius); } camera.end(); minDepthFbo.end(); maxDepthFbo.begin(); maxDepthFbo.clearDepthBuffer(1.f); glDepthFunc(GL_LESS); camera.begin(); for(auto & sphere: blob){ ofDrawSphere(sphere.pos, sphere.radius); } camera.end(); maxDepthFbo.end(); minMaxDepthShader.end(); ofDisableDepthTest(); /*ofEnableDepthTest(); camera.begin(); for(auto & sphere: blob){ ofDrawSphere(sphere.pos, sphere.radius); } camera.end(); ofDisableDepthTest();*/ }
void PostProcessing::begin(ofCamera& cam) { // update camera matrices cam.begin(); cam.end(); raw.begin(false); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadMatrixf(cam.getProjectionMatrix(ofRectangle(0, 0, width, height)).getPtr()); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadMatrixf(cam.getModelViewMatrix().getPtr()); glViewport(0, 0, raw.getWidth(), raw.getHeight()); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); }
void PostProcessing::begin(ofCamera& cam) { // update camera matrices cam.begin(); cam.end(); raw.begin(ofFboBeginMode::NoDefaults); ofMatrixMode(OF_MATRIX_PROJECTION); ofPushMatrix(); ofLoadMatrix(cam.getProjectionMatrix(ofRectangle(0, 0, width, height))); ofMatrixMode(OF_MATRIX_MODELVIEW); ofPushMatrix(); ofLoadMatrix(cam.getModelViewMatrix()); ofViewport(0, 0, raw.getWidth(), raw.getHeight()); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); ofPushStyle(); glPushAttrib(GL_ENABLE_BIT); }