- Camera* backgroundCamera = cameras[BACKGROUND_CAMERA].get();
- backgroundCamera->setClearMask(GL_DEPTH_BUFFER_BIT);
- // Turn off depth test for the background
- Depth* depth = new Depth(Depth::LESS, 0.0, 1.0, false);
- StateSet* backgroundSS = new StateSet;
- backgroundSS->setAttribute(depth);
- backgroundSS->setMode(GL_DEPTH_TEST, StateAttribute::OFF);
- backgroundCamera->setStateSet(backgroundSS);
- backgroundCamera->setInheritanceMask(backgroundCamera->getInheritanceMask()
- & ~CullSettings::CULL_MASK);
- backgroundCamera->setCullMask(simgear::BACKGROUND_BIT);
- cameras[NEAR_CAMERA]->setClearMask(GL_DEPTH_BUFFER_BIT);
- // Background camera will have cleared the buffers and doesn't
- // touch the depth buffer
- cameras[FAR_CAMERA]->setClearMask(0);