]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/od_gauge.cxx
Projection matrix and texture size should be coherent
[flightgear.git] / src / Instrumentation / od_gauge.cxx
index 25184450c1229dea298760a6b2b323e12c0abce9..e5eed1efc22da9eeddef0d7193ac3ac12316bde8 100644 (file)
@@ -37,6 +37,7 @@
 #include <osg/StateSet>
 #include <osgDB/FileNameUtils>
 
+#include <simgear/scene/util/RenderConstants.hxx>
 #include <simgear/screen/extensions.hxx>
 #include <simgear/debug/logstream.hxx>
 
@@ -53,8 +54,9 @@ FGODGauge::FGODGauge() :
 
 void FGODGauge::allocRT () {
     camera = new osg::Camera;
-    camera->setProjectionMatrix(osg::Matrix::ortho2D(-256.0, 256.0, -256.0,
-            256.0));
+    // Only the far camera should trigger this texture to be rendered.
+    camera->setNodeMask(simgear::BACKGROUND_BIT);
+    camera->setProjectionMatrix(osg::Matrix::ortho2D(-textureWH/2.0, textureWH/2.0, -textureWH/2.0, textureWH/2.0));
     camera->setViewport(0, 0, textureWH, textureWH);
     camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
     camera->setRenderOrder(osg::Camera::PRE_RENDER);