Index: osgVisual/trunk/include/distortion/visual_distortion.h
===================================================================
--- osgVisual/trunk/include/distortion/visual_distortion.h	(revision 304)
+++ osgVisual/trunk/include/distortion/visual_distortion.h	(revision 305)
@@ -481,9 +481,4 @@
 
 	/**
-	 * Target implementation which should be used to distort.
-	 */ 
-	osg::Camera::RenderTargetImplementation renderImplementation;
-
-	/**
 	 * Reference to the global ArgumentParser. The arguments are required to add the help entry for the toggle distortion key. All other configuration is located in the XML file.
 	 */ 
Index: osgVisual/trunk/include/util/terrainQuery.h
===================================================================
--- osgVisual/trunk/include/util/terrainQuery.h	(revision 304)
+++ osgVisual/trunk/include/util/terrainQuery.h	(revision 305)
@@ -15,6 +15,6 @@
 */
 
-#ifndef OSGSIM_HEIGHTABOVETERRAIN
-#define OSGSIM_HEIGHTABOVETERRAIN 1
+#ifndef osgVisual_HEIGHTABOVETERRAIN
+#define osgVisual_HEIGHTABOVETERRAIN 1
 
 #include <osgUtil/IntersectionVisitor>
@@ -23,8 +23,8 @@
 #include <osgSim/LineOfSight>
 
-namespace osgSim {
+namespace osgVisual {
 
 /** Helper class for setting up and acquiring height above terrain intersections with terrain.
-  * By default assigns a osgSim::DatabaseCacheReadCallback that enables automatic loading
+  * By default assigns a osgVisual::DatabaseCacheReadCallback that enables automatic loading
   * of external PagedLOD tiles to ensure that the highest level of detail is used in intersections.
   * This automatic loading of tiles is done by the intersection traversal that is done within
@@ -33,10 +33,16 @@
   * The external loading of tiles can be disabled by removing the read callback, this is done by
   * calling the setDatabaseCacheReadCallback(DatabaseCacheReadCallback*) method with a value of 0.*/
-class OSGSIM_EXPORT HeightAboveTerrain
+class terrainQuery
 {
     public :
 
+		enum DataSource
+		{
+			LOADED_SCENE,
+			PAGE_HIGHEST_LOD
+			
+		};
     
-        HeightAboveTerrain(bool loadHighestLOD = true);
+        terrainQuery();
         
     
@@ -81,8 +87,8 @@
 
         /** Compute the vertical distance between the specified scene graph and a single HAT point. */
-        static double computeHeightAboveTerrain(osg::Node* scene, const osg::Vec3d& point, bool loadHighestLOD = true, osg::Node::NodeMask traversalMask=0xffffffff);
+        static double computeHeightAboveTerrain(osg::Node* scene, const osg::Vec3d& point, DataSource pagingBehaviour, osg::Node::NodeMask traversalMask=0xffffffff);
         
 		/** Compute the vertical position of the scene at a single HOT point. */
-        static double computeHeightOfTerrain(osg::Node* scene, const osg::Vec3d& point, bool loadHighestLOD = true, osg::Node::NodeMask traversalMask=0xffffffff);
+        static double computeHeightOfTerrain(osg::Node* scene, const osg::Vec3d& point, DataSource pagingBehaviour, osg::Node::NodeMask traversalMask=0xffffffff);
 
         
@@ -93,8 +99,8 @@
           * Note, if you have multiple LineOfSight or HeightAboveTerrain objects in use at one time then you should share a single
           * DatabaseCacheReadCallback between all of them. */
-        void setDatabaseCacheReadCallback(DatabaseCacheReadCallback* dcrc);
+		void setDatabaseCacheReadCallback(osgSim::DatabaseCacheReadCallback* dcrc);
 
         /** Get the ReadCallback that does the reading of external PagedLOD models, and caching of loaded subgraphs.*/
-        DatabaseCacheReadCallback* getDatabaseCacheReadCallback() { return _dcrc.get(); }
+		osgSim::DatabaseCacheReadCallback* getDatabaseCacheReadCallback() { return _dcrc.get(); }
         
     protected :
@@ -118,6 +124,5 @@
         HATList                                 _HATList;
 
-        
-        osg::ref_ptr<DatabaseCacheReadCallback> _dcrc;
+		osg::ref_ptr<osgSim::DatabaseCacheReadCallback> _dcrc;
         osgUtil::IntersectionVisitor            _intersectionVisitor;
 
Index: osgVisual/trunk/src/core/visual_core.cpp
===================================================================
--- osgVisual/trunk/src/core/visual_core.cpp	(revision 304)
+++ osgVisual/trunk/src/core/visual_core.cpp	(revision 305)
@@ -47,4 +47,7 @@
 	// Configure osg to use KdTrees
 	osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES);
+
+	// Configure Multisampling
+	osg::DisplaySettings::instance()->setNumMultiSamples(4);
 
 	// Setup pathes
@@ -370,6 +373,6 @@
 	else
 	{
-		OSG_ALWAYS << "BorderEqual activated" << std::endl;
-		terrain->setEqualizeBoundaries(true);
+		//OSG_ALWAYS << "BorderEqual activated" << std::endl;
+		//terrain->setEqualizeBoundaries(true);
 	}
 
Index: osgVisual/trunk/src/distortion/visual_distortion.cpp
===================================================================
--- osgVisual/trunk/src/distortion/visual_distortion.cpp	(revision 304)
+++ osgVisual/trunk/src/distortion/visual_distortion.cpp	(revision 305)
@@ -97,18 +97,5 @@
 							OSG_NOTIFY(osg::WARN) << "WARNING: Unable to parse Frustum values from '" << pre_cfg<<channelname<<post_cfg << "' -- continue without valid frustum values." << std::endl;
 					}
-					if( attr_name == "renderimplementation" )
-					{
-						if(attr_value=="fbo")
-							renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT;
-						if(attr_value=="pbuffer")
-							renderImplementation = osg::Camera::PIXEL_BUFFER;
-						if(attr_value=="pbuffer-rtt")
-							renderImplementation = osg::Camera::PIXEL_BUFFER_RTT;
-						if(attr_value=="fb")
-							renderImplementation = osg::Camera::FRAME_BUFFER;
-						if(attr_value=="window")
-							renderImplementation = osg::Camera::SEPERATE_WINDOW;           
-					}
-					if( attr_name == "width" )
+         			if( attr_name == "width" )
 					{
 						std::stringstream sstr(attr_value);
@@ -185,6 +172,4 @@
 	tex_width = 2048;
     tex_height = 2048;
-	renderImplementation = osg::Camera::FRAME_BUFFER_OBJECT;
-	useTextureRectangle = false;
 	useShaderDistortion = false;
 	useHDR = false; 
@@ -270,25 +255,12 @@
 
     // texture to render to and to use for rendering of flag.
-    osg::Texture* texture = 0;
-    if (useTextureRectangle)
-    {
-        osg::TextureRectangle* textureRect = new osg::TextureRectangle;
-        textureRect->setTextureSize(tex_width, tex_height);
-        textureRect->setInternalFormat(GL_RGBA);
-        textureRect->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
-        textureRect->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
-        
-        texture = textureRect;
-    }
-    else
-    {
-        osg::Texture2D* texture2D = new osg::Texture2D;
-        texture2D->setTextureSize(tex_width, tex_height);
-        texture2D->setInternalFormat(GL_RGBA);
-        texture2D->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
-        texture2D->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
-        
-        texture = texture2D;
-    } 
+    //osg::Texture* texture = 0;
+    osg::Texture2D* texture = new osg::Texture2D;
+    texture->setTextureSize(tex_width, tex_height);
+    texture->setInternalFormat(GL_RGBA);
+    texture->setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
+    texture->setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
+    
+    //texture = texture2D;
 
     if (useHDR)
@@ -328,6 +300,6 @@
         osg::Vec3 yAxis(0.0f,1.0f,0.0f);
         osg::Vec3 zAxis(0.0f,0.0f,1.0f);
-        float height = 1024.0f;
-        float width = 1280.0f;
+        float width = 1600.0f;
+		float height = 900.0f;
         int noSteps = 128;
         if (useShaderDistortion)
@@ -423,11 +395,9 @@
         camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
         camera->setViewMatrix(osg::Matrix::identity());
-        //sceneCamera->setProjectionMatrixAsOrtho2D(0,viewer->getCamera()->getViewport()->width(),0,viewer->getCamera()->getViewport()->height());
-		camera->setProjectionMatrixAsOrtho2D(0,1280,0,1024);
-		/** \todo: use screen size dynamically */
-
+		camera->setProjectionMatrixAsOrtho2D(0,1600,0,900);		/** \todo: use screen size dynamically */
+		
         // set the camera to render before the main camera.
         camera->setRenderOrder(osg::Camera::POST_RENDER, 200);
-
+		
         // only clear the depth buffer
         camera->setClearMask(0);
@@ -495,9 +465,9 @@
 
         // tell the camera to use OpenGL frame buffer object where supported.
-        camera->setRenderTargetImplementation(renderImplementation);
+        camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
 
         // attach the texture and use it as the color buffer.
-        camera->attach(osg::Camera::COLOR_BUFFER, texture);	// No Multisampling/Antialiasing
-		//camera->attach(osg::Camera::COLOR_BUFFER, texture, 0, 0, false, 4, 4); // 4x Multisampling/Antialiasing
+        //camera->attach(osg::Camera::COLOR_BUFFER, texture);	// No Multisampling/Antialiasing
+		camera->attach(osg::Camera::COLOR_BUFFER, texture, 0, 0, false, 4, 4); // 4x Multisampling/Antialiasing
 
         // add subgraph to render
Index: osgVisual/trunk/src/draw2D/visual_debug_hud.cpp
===================================================================
--- osgVisual/trunk/src/draw2D/visual_debug_hud.cpp	(revision 304)
+++ osgVisual/trunk/src/draw2D/visual_debug_hud.cpp	(revision 305)
@@ -16,5 +16,5 @@
 
 #include <visual_debug_hud.h>
-#include <osgSim/HeightAboveTerrain>
+#include <terrainQuery.h>
 
 using namespace osgVisual;
@@ -142,14 +142,14 @@
 
 	util::getWGS84ofCamera( sceneCamera, csn, lat, lon, alt ); 
-	//util::queryHeightAboveTerrainInWGS84(hat, csn, lat, lon, alt);
-	//util::queryHeightOfTerrain(hot, csn, lat, lon);
+	util::queryHeightAboveTerrainInWGS84(hat, csn, lat, lon, alt);
+	util::queryHeightOfTerrain(hot, csn, lat, lon);
 
-	double x = 0;
+	/*double x = 0;
 	double y = 0;
 	double z = 0;
 
 	util::getXYZofCamera( sceneCamera, x, y, z ); 
-	hat = osgSim::HeightAboveTerrain::computeHeightAboveTerrain(csn, osg::Vec3d(x,y,z), false);
-	hot = osgSim::HeightAboveTerrain::computeHeightOfTerrain(csn, osg::Vec3d(x,y,z), false);
+	hat = terrainQuery::computeHeightAboveTerrain(csn, osg::Vec3d(x,y,z), terrainQuery::PAGE_HIGHEST_LOD);
+	hot = terrainQuery::computeHeightOfTerrain(csn, osg::Vec3d(x,y,z), terrainQuery::PAGE_HIGHEST_LOD);*/
 
 
Index: osgVisual/trunk/src/util/terrainQuery.cpp
===================================================================
--- osgVisual/trunk/src/util/terrainQuery.cpp	(revision 304)
+++ osgVisual/trunk/src/util/terrainQuery.cpp	(revision 305)
@@ -21,20 +21,20 @@
 #include <osgUtil/LineSegmentIntersector>
 
+using namespace osgVisual;
 using namespace osgSim;
 
-HeightAboveTerrain::HeightAboveTerrain(bool loadHighestLOD)
+terrainQuery::terrainQuery()
 {
     _lowestHeight = -1000.0;
     
-	if(loadHighestLOD)
-		setDatabaseCacheReadCallback(new DatabaseCacheReadCallback);
+	setDatabaseCacheReadCallback(new DatabaseCacheReadCallback);
 }
 
-void HeightAboveTerrain::clear()
+void terrainQuery::clear()
 {
     _HATList.clear();
 }
 
-unsigned int HeightAboveTerrain::addPoint(const osg::Vec3d& point)
+unsigned int terrainQuery::addPoint(const osg::Vec3d& point)
 {
     unsigned int index = _HATList.size();
@@ -43,5 +43,5 @@
 }
 
-void HeightAboveTerrain::computeIntersections(osg::Node* scene, osg::Node::NodeMask traversalMask)
+void terrainQuery::computeIntersections(osg::Node* scene, osg::Node::NodeMask traversalMask)
 {
     osg::CoordinateSystemNode* csn = dynamic_cast<osg::CoordinateSystemNode*>(scene);
@@ -128,21 +128,23 @@
 }
 
-double HeightAboveTerrain::computeHeightAboveTerrain(osg::Node* scene, const osg::Vec3d& point, bool loadHighestLOD, osg::Node::NodeMask traversalMask)
+double terrainQuery::computeHeightAboveTerrain(osg::Node* scene, const osg::Vec3d& point, DataSource pagingBehaviour, osg::Node::NodeMask traversalMask)
 {
-    HeightAboveTerrain hat(loadHighestLOD);
-    unsigned int index = hat.addPoint(point);
-    hat.computeIntersections(scene, traversalMask);
-    return hat.getHeightAboveTerrain(index);
+    terrainQuery qt;
+	/*if(!loadHighestLOD)
+		qt.setDatabaseCacheReadCallback(0);*/
+    unsigned int index = qt.addPoint(point);
+    qt.computeIntersections(scene, traversalMask);
+    return qt.getHeightAboveTerrain(index);
 }
 
-double HeightAboveTerrain::computeHeightOfTerrain(osg::Node* scene, const osg::Vec3d& point, bool loadHighestLOD, osg::Node::NodeMask traversalMask)
+double terrainQuery::computeHeightOfTerrain(osg::Node* scene, const osg::Vec3d& point, DataSource pagingBehaviour, osg::Node::NodeMask traversalMask)
 {
-	HeightAboveTerrain hat(loadHighestLOD);
-    unsigned int index = hat.addPoint(point);
-    hat.computeIntersections(scene, traversalMask);
-    return hat.getHeightOfTerrain(index);
+	terrainQuery qt;
+    unsigned int index = qt.addPoint(point);
+    qt.computeIntersections(scene, traversalMask);
+    return qt.getHeightOfTerrain(index);
 }
 
-void HeightAboveTerrain::setDatabaseCacheReadCallback(DatabaseCacheReadCallback* dcrc)
+void terrainQuery::setDatabaseCacheReadCallback(DatabaseCacheReadCallback* dcrc)
 {
     _dcrc = dcrc;
