| 159 | | |
| 160 | | #else |
| 161 | | |
| 162 | | #if 0 |
| 163 | | // to ensure the hud appears on top we can either use osg::Depth to force the |
| 164 | | // depth fragments to be placed at the front of the screen. |
| 165 | | stateset->setAttribute(new osg::Depth(osg::Depth::LESS,0.0,0.0001)); |
| 166 | | #else |
| 167 | | // or disable depth test, and make sure that the hud is drawn after everything |
| 168 | | // else so that it always appears ontop. |
| 169 | | stateset->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF); |
| 170 | | stateset->setRenderBinDetails(11,"RenderBin"); |
| 171 | | #endif |
| 172 | | |
| 173 | | |
| 174 | | |
| 175 | | // create the hud. |
| 176 | | osg::MatrixTransform* modelview_abs = new osg::MatrixTransform; |
| 177 | | modelview_abs->setReferenceFrame(osg::Transform::ABSOLUTE_RF); |
| 178 | | modelview_abs->setMatrix(osg::Matrix::identity()); |
| 179 | | modelview_abs->addChild(geode); |
| 180 | | |
| 181 | | osg::Projection* projection = new osg::Projection; |
| 182 | | projection->setMatrix(osg::Matrix::ortho2D(0,1280,0,1024)); |
| 183 | | projection->addChild(modelview_abs); |
| 184 | | |
| 185 | | return projection; |
| 186 | | #endif |