Index: /GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/IVReader.vcproj
===================================================================
--- /GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/IVReader.vcproj	(revision 1826)
+++ /GTP/trunk/Lib/Vis/OnlineCullingCHC/IVReader/src/IVReader.vcproj	(revision 1926)
@@ -268,4 +268,55 @@
 				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
+		<Configuration
+			Name="Release_qt|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;..\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;IVREADER_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib"
+				OutputFile="$(OutDir)/IVReader.dll"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;..\..\GtpVisibility\lib\$(ConfigurationName)&quot;;&quot;..\..\lib\$(ConfigurationName)&quot;;&quot;..\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;"
+				GenerateDebugInformation="FALSE"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				ImportLibrary="$(OutDir)/IVReader.lib"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy $(OutDir)\$(TargetFileName) &quot;$(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName)&quot;"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
 	</Configurations>
 	<References>
Index: /GTP/trunk/Lib/Vis/OnlineCullingCHC/src/GtpVisibility.vcproj
===================================================================
--- /GTP/trunk/Lib/Vis/OnlineCullingCHC/src/GtpVisibility.vcproj	(revision 1521)
+++ /GTP/trunk/Lib/Vis/OnlineCullingCHC/src/GtpVisibility.vcproj	(revision 1926)
@@ -222,4 +222,48 @@
 				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
+		<Configuration
+			Name="Release_qt|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				GlobalOptimizations="TRUE"
+				FavorSizeOrSpeed="1"
+				OmitFramePointers="TRUE"
+				OptimizeForWindowsApplication="TRUE"
+				AdditionalIncludeDirectories="..\include;&quot;$(OGRE_PATH)\OgreMain\include&quot;;..\..\Preprocessing\src"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				RuntimeLibrary="2"
+				RuntimeTypeInfo="TRUE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="$(OutDir)/GtpVisibility.lib"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
 	</Configurations>
 	<References>
Index: /GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj
===================================================================
--- /GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj	(revision 1826)
+++ /GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj	(revision 1926)
@@ -347,4 +347,74 @@
 				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
+		<Configuration
+			Name="Release_qt|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			WholeProgramOptimization="TRUE">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				ImproveFloatingPointConsistency="TRUE"
+				FavorSizeOrSpeed="1"
+				OmitFramePointers="TRUE"
+				EnableFiberSafeOptimizations="TRUE"
+				OptimizeForProcessor="0"
+				OptimizeForWindowsApplication="TRUE"
+				AdditionalIncludeDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\include&quot;;&quot;$(OGRE_PATH)\Samples\Common\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include\CEGUI&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\include&quot;;&quot;$(OGRE_PATH)\OgreMain\include&quot;;&quot;$(OGRE_PATH)\Dependencies\include&quot;;..\include;..\..\..\OnlineCullingCHC\include;..\..\..\Preprocessing\src;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\include"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;PLUGIN_KD_TERRAIN_EXPORTS;GTP_VISIBILITY_MODIFIED_OGRE"
+				StringPooling="TRUE"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="FALSE"
+				EnableFunctionLevelLinking="TRUE"
+				RuntimeTypeInfo="TRUE"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				IgnoreImportLibrary="TRUE"
+				AdditionalDependencies="OgreMain.lib CEGUIBase.lib OgreGUIRenderer.lib Plugin_OctreeSceneManager.lib GtpVisibility.lib zdll.lib zziplib.lib Preprocessor.lib xerces-c_2.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib glew32.lib glew32s.lib IVReader.lib"
+				OutputFile="$(OutDir)/Plugin_VisibilitySceneManager.dll"
+				Version="0.99"
+				LinkIncremental="1"
+				SuppressStartupBanner="TRUE"
+				AdditionalLibraryDirectories="&quot;$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\OgreMain\lib\$(ConfigurationName)&quot;;&quot;$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib&quot;;&quot;$(OGRE_PATH)\Dependencies\lib\$(ConfigurationName)&quot;;&quot;..\..\..\Preprocessing\lib\$(ConfigurationName)&quot;;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;..\..\..\..\..\..\..\NonGTP\Zlib\lib;&quot;..\..\lib\$(ConfigurationName)&quot;;&quot;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\lib\$(ConfigurationName)&quot;"
+				ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def"
+				GenerateDebugInformation="FALSE"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				ImportLibrary="$(OutDir)/Plugin_VisibilitySceneManager.lib"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="copy $(OutDir)\$(TargetFileName) $(OGRE_PATH)\Samples\Common\bin\$(ConfigurationName)"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
 	</Configurations>
 	<References>
Index: /GTP/trunk/Lib/Vis/Preprocessing/EvalStats/EvalStats.vcproj
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/EvalStats/EvalStats.vcproj	(revision 1239)
+++ /GTP/trunk/Lib/Vis/Preprocessing/EvalStats/EvalStats.vcproj	(revision 1926)
@@ -199,4 +199,50 @@
 		<Configuration
 			Name="Release Internal|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="0"
+				UsePrecompiledHeader="3"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(OutDir)/EvalStats.exe"
+				LinkIncremental="1"
+				GenerateDebugInformation="TRUE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release_qt|Win32"
 			OutputDirectory="$(ConfigurationName)"
 			IntermediateDirectory="$(ConfigurationName)"
@@ -282,4 +328,10 @@
 				<FileConfiguration
 					Name="Release Internal|Win32">
+					<Tool
+						Name="VCCLCompilerTool"
+						UsePrecompiledHeader="1"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release_qt|Win32">
 					<Tool
 						Name="VCCLCompilerTool"
Index: /GTP/trunk/Lib/Vis/Preprocessing/scripts/preprocess_visibility.env
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/scripts/preprocess_visibility.env	(revision 1746)
+++ /GTP/trunk/Lib/Vis/Preprocessing/scripts/preprocess_visibility.env	(revision 1926)
@@ -15,8 +15,9 @@
 	# stored sample rays
 	samplesFilename rays.out
-	useGlRenderer false
+	useGlRenderer true
+	#useGlRenderer false
 	useGlDebugger false
-# 0 = INTERNAL 		1 = MLRT
-
+
+	# 0 = INTERNAL	1 = MLRT
 	rayCastMethod 0
 	
@@ -67,6 +68,4 @@
 		pvs false
 		rssTree false
-		rays false
-		numRays 2000
 	}
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/scripts/preprocess_visibility.sh
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/scripts/preprocess_visibility.sh	(revision 1746)
+++ /GTP/trunk/Lib/Vis/Preprocessing/scripts/preprocess_visibility.sh	(revision 1926)
@@ -2,4 +2,5 @@
 
 PREPROCESSOR=../bin/release/preprocessor.exe
+#PREPROCESSOR=../bin/debug/preprocessor.exe
 
 if [ $# -ne 3 ]
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj	(revision 1923)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj	(revision 1926)
@@ -79,5 +79,5 @@
 				OptimizeForWindowsApplication="TRUE"
 				AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\MultiLevelRayTracing"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NO_QT"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
 				RuntimeLibrary="2"
 				RuntimeTypeInfo="TRUE"
@@ -193,6 +193,6 @@
 				OptimizeForProcessor="3"
 				OptimizeForWindowsApplication="TRUE"
-				AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(QTDIR)\include\Qt&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include&quot;"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;NO_QT"
+				AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(QTDIR)\include\Qt&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtGui&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT"
 				RuntimeLibrary="2"
 				RuntimeTypeInfo="TRUE"
@@ -252,5 +252,5 @@
 				OptimizeForWindowsApplication="TRUE"
 				AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(QTDIR)\include\Qt&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include&quot;"
-				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;NO_QT"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL"
 				RuntimeLibrary="2"
 				RuntimeTypeInfo="TRUE"
@@ -266,5 +266,64 @@
 				OutputFile="../bin/release/Preprocessor.exe"
 				LinkIncremental="1"
-				AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;&quot;$(QTDIR)\lib&quot;;.\QtGlRenderer\Release"
+				AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;.\QtGlRenderer\Release"
+				GenerateDebugInformation="FALSE"
+				SubSystem="1"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				TargetMachine="1"
+				FixedBaseAddress="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="Release_qt|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OptimizeForProcessor="0"
+				OptimizeForWindowsApplication="TRUE"
+				AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\MultiLevelRayTracing;&quot;$(QTDIR)\include\QtOpenGl&quot;;&quot;$(QTDIR)\include\Qt&quot;;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtGui&quot;;.\QtGlRenderer"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;USE_QT"
+				RuntimeLibrary="2"
+				RuntimeTypeInfo="TRUE"
+				UsePrecompiledHeader="0"
+				BrowseInformation="1"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib QtCore4.lib qtmain.lib QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtGlRenderer.lib"
+				OutputFile="../bin/release/Preprocessor.exe"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="..\src\GL;..\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;&quot;$(QTDIR)\lib&quot;;.\QtGlRenderer\Release"
 				GenerateDebugInformation="FALSE"
 				SubSystem="1"
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtPreprocessorThread.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtPreprocessorThread.cpp	(revision 1867)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtPreprocessorThread.cpp	(revision 1926)
@@ -1,4 +1,4 @@
-#ifdef GTP_INTERNAL
-#ifndef NO_QT
+#ifdef USE_QT
+
 #include <QApplication>
 #include "QtPreprocessorThread.h"
@@ -13,11 +13,10 @@
 
 QtPreprocessorThread::QtPreprocessorThread(Preprocessor *p,
-										   QObject *parent):PreprocessorThread(p),
-															QThread(parent)
-															
+										   QObject *parent)
+: PreprocessorThread(p), QThread(parent)															
 {
-  if (p->mQuitOnFinish)
+	if (p->mQuitOnFinish)
 	{
-	  connect(this, SIGNAL(finished()), qApp, SLOT(closeAllWindows(void)));
+		connect(this, SIGNAL(finished()), qApp, SLOT(closeAllWindows(void)));
 	}
 }
@@ -26,6 +25,7 @@
 QtPreprocessorThread::~QtPreprocessorThread()
 {
-  cerr<<"Preprocessor thread destructor...\n";
+  cerr << "Preprocessor thread destructor...\n";
 }
+
 
 int
@@ -41,5 +41,3 @@
 }
 
-
 #endif
-#endif
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.cpp	(revision 1925)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.cpp	(revision 1926)
@@ -28,6 +28,4 @@
 const int depthMapSize = 512;
 
-//static vector<OcclusionQuery *> sQueries;
-
 QtGlRendererWidget *rendererWidget = NULL;
 QtGlDebuggerWidget *debuggerWidget = NULL;
@@ -55,5 +53,4 @@
 	mViewCellsManager->GetViewPoint(mViewPoint);
 	sample.mPosition = mViewPoint;
-	//cout << "viewpoint: " << mViewPoint << endl;
 
 	// take a render cost sample by rendering a cube
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlViewer.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlViewer.h	(revision 1926)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlViewer.h	(revision 1926)
@@ -0,0 +1,55 @@
+#ifndef __QTGLVIEWER_H
+#define __QTGLVIEWER_H
+
+#include <QtOpenGL>
+#include <QWaitCondition>
+
+namespace GtpVisibilityPreprocessor {
+
+class QtGlRendererWidget;
+
+
+class __declspec(dllexport) QtGlViewer: public QGLWidget
+{	
+	//Q_OBJECT
+
+public:
+	
+	QtGlViewer(QWidget *parent, QtGlRendererWidget *renderer);
+
+	virtual ~QtGlViewer() {};
+
+	QSize minimumSizeHint() const;
+	QSize sizeHint() const;
+
+	// This method has to be rendefined by all renderer implementations
+	virtual void RenderScene();
+
+	QtGlRendererWidget *mRenderer;
+
+protected:
+
+	void initializeGL();
+	void paintGL();
+	void resizeGL(int width, int height);
+	void mousePressEvent(QMouseEvent *event);
+	void mouseMoveEvent(QMouseEvent *event);
+
+	void keyPressEvent ( QKeyEvent * e );
+
+	bool mWireframe;
+
+private:
+
+	float manipulatorLastQuat[4];
+	float scale;
+	
+	QPoint lastPos;
+
+	friend class QtGlRendererWidget;
+	friend class GlRenderer;
+};
+
+}
+
+#endif
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.vcproj
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.vcproj	(revision 1925)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.vcproj	(revision 1926)
@@ -90,6 +90,62 @@
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalDependencies="Preprocessor.lib qtmain.lib QtGui4.lib Qt3Support4.lib QAxContainer.lib QtCore4.lib QtOpenGL4.lib xerces-c_2.lib glew32.lib OpenGL32.Lib glu32.lib cg.lib RTScene.lib RTWorld.lib cgGL.lib"
-				OutputFile="$(OutDir)/QtGlRenderer.dll"
+				AdditionalDependencies="Preprocessor.lib qtmain.lib QtGui4.lib Qt3Support4.lib QAxContainer.lib QtCore4.lib QtOpenGL4.lib xerces-c_2.lib glew32.lib OpenGL32.Lib glu32.lib cg.lib cgGL.lib"
+				OutputFile="Release/QtGlRenderer.dll"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;..\$(ConfigurationName)&quot;;&quot;..\..\lib\$(ConfigurationName)&quot;;..\..\src\GL;..\..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;&quot;$(CG_LIB_PATH)&quot;;&quot;$(QTDIR)\lib&quot;"
+				GenerateDebugInformation="FALSE"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				ImportLibrary="$(OutDir)/QtGlRenderer.lib"
+				TargetMachine="1"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				Description="&quot;copy dll to preprocessor dir&quot;"
+				CommandLine="copy $(OutDir)\*.dll ..\..\bin\"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCWebDeploymentTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
+		<Configuration
+			Name="release_internal|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\src;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;&quot;$(QTDIR)\include\QtOpenGl&quot;;..\..\..\..\..\..\..\NonGTP\Zlib\include;&quot;$(CG_INC_PATH)&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;QTGLRENDERER_EXPORTS"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"
+				Description="Performing moc on $(InputName).h"
+				CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp
+"
+				Outputs="$(InputDir) moc_$(InputName).cpp"/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="Preprocessor.lib qtmain.lib QtGui4.lib Qt3Support4.lib QAxContainer.lib QtCore4.lib QtOpenGL4.lib xerces-c_2.lib glew32.lib OpenGL32.Lib glu32.lib cg.lib cgGL.lib RTScene.lib RTWorld.lib"
+				OutputFile="Release/QtGlRenderer.dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(QTDIR)\lib&quot;;..\..\..\..\..\..\..\NonGTP\Zlib\lib;&quot;$(CG_LIB_PATH)&quot;;..\..\src\GL;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;&quot;..\..\lib\$(ConfigurationName)&quot;;..\..\MultiLevelRayTracing\RTScene\Release;..\..\MultiLevelRayTracing\RTWorld\Release"
@@ -135,8 +191,14 @@
 			</File>
 			<File
+				RelativePath=".\moc_QtGlViewer.cpp">
+			</File>
+			<File
 				RelativePath=".\QtGlRenderer.cpp">
 			</File>
 			<File
 				RelativePath=".\QtGlRendererDll.cpp">
+			</File>
+			<File
+				RelativePath=".\QtGlViewer.cpp">
 			</File>
 		</Filter>
@@ -154,4 +216,24 @@
 						CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp
 "
+						Outputs="$(InputDir) moc_$(InputName).cpp"/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="release_internal|Win32">
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing moc on $(InputName).h"
+						CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp
+"
+						Outputs="$(InputDir) moc_$(InputName).cpp"/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath=".\QtGlViewer.h">
+				<FileConfiguration
+					Name="Release|Win32">
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="Performing moc on $(InputName).h"
+						CommandLine="%qtdir%\bin\moc.exe $(InputDir)$(InputName).h -o $(InputDir)moc_$(InputName).cpp"
 						Outputs="$(InputDir) moc_$(InputName).cpp"/>
 				</FileConfiguration>
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.h	(revision 1925)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.h	(revision 1926)
@@ -37,4 +37,5 @@
 {
 	Q_OBJECT
+
 public:
 	QtGlRendererBuffer(const int w,
@@ -68,54 +69,50 @@
 		const int threshold = 0);
 
-
-  void
-  EvalPvsStat();
-
-  void
-  ClearErrorBuffer();
-  
-
-  virtual int GetWidth() const { return width(); }
-  virtual int GetHeight() const { return height(); }
-
-
- 
-  void SampleBeamContributions(
-							   Intersectable *sourceObject,
-							   Beam &beam,
-							   const int samples,
-							   BeamSampleStatistics &stat
-							   );
-
-  void
-  SampleViewpointContributions(
-							   Intersectable *sourceObject,
-							   const Vector3 viewPoint,
-							   Beam &beam,
-							   const int desiredSamples,
-							   BeamSampleStatistics &stat
-							   );
-
-  void InitGL();
-
-  /** Computes rays from information gained with hw sampling-
-  */
-  void ComputeRays(Intersectable *sourceObj, VssRayContainer &rays);
-
-  float
-  GetPixelError(int &pvsSize);
-
-  int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const;
-     
-   
+	void
+		EvalPvsStat();
+
+	void
+		ClearErrorBuffer();
+
+	virtual int GetWidth() const { return width(); }
+	virtual int GetHeight() const { return height(); }
+
+	void SampleBeamContributions(
+		Intersectable *sourceObject,
+		Beam &beam,
+		const int samples,
+		BeamSampleStatistics &stat
+		);
+
+	void
+		SampleViewpointContributions(
+		Intersectable *sourceObject,
+		const Vector3 viewPoint,
+		Beam &beam,
+		const int desiredSamples,
+		BeamSampleStatistics &stat
+		);
+
+	void InitGL();
+
+	/** Computes rays from information gained with hw sampling-
+	*/
+	void ComputeRays(Intersectable *sourceObj, VssRayContainer &rays);
+
+	float
+		GetPixelError(int &pvsSize);
+
+	int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const;
+
+
 private:
-  	
+
 	void SetupProjectionForViewPoint(const Vector3 &viewPoint, 
-									 const Beam &beam, 
-									 Intersectable *sourceObject);
-
-
-public:
-  signals:
+		const Beam &beam, 
+		Intersectable *sourceObject);
+
+
+public:
+signals:
 	void UpdatePvsErrorItem(int i, GlRendererBuffer::PvsErrorEntry &);
 };
@@ -124,178 +121,181 @@
 class __declspec(dllexport) QtRendererControlWidget : public QWidget
 {
-  Q_OBJECT
-public:
-
-  QListWidget *mPvsErrorWidget;
-
-  QtRendererControlWidget(QWidget * parent = 0, Qt::WFlags f = 0);
-
-  public slots:
-
-  void FocusNextPvsErrorFrame();
-  void UpdatePvsErrorItem(int i,
-						  GlRendererBuffer::PvsErrorEntry &);
-
-  signals:
-  
-  void SetViewCellGranularity(int);
-  void SetSceneCut(int);
-  void SetTopDistance(int);
-  void SetVisibilityFilterSize(int);
-  void SetSpatialFilterSize(int);
-
-  void SetRenderFilter(bool);
-  void SetUseFilter(bool);
-  void SetUseSpatialFilter(bool);
-  void SetRenderErrors(bool);
-  void SetShowViewCells(bool);
-  void SetShowRenderCost(bool);
-  void SetShowPvsSizes(bool);
-  void SetTopView(bool);
-  void SetCutViewCells(bool);
-  void SetCutScene(bool);
-
-  
-};
+	Q_OBJECT
+public:
+
+	QListWidget *mPvsErrorWidget;
+
+	QtRendererControlWidget(QWidget * parent = 0, Qt::WFlags f = 0);
+
+public slots:
+
+	void FocusNextPvsErrorFrame();
+	void UpdatePvsErrorItem(int i,
+		GlRendererBuffer::PvsErrorEntry &);
+
+signals:
+
+	void SetViewCellGranularity(int);
+	void SetSceneCut(int);
+	void SetTopDistance(int);
+	void SetVisibilityFilterSize(int);
+	void SetSpatialFilterSize(int);
+
+	void SetRenderFilter(bool);
+	void SetUseFilter(bool);
+	void SetUseSpatialFilter(bool);
+	void SetRenderErrors(bool);
+	void SetShowViewCells(bool);
+	void SetShowRenderCost(bool);
+	void SetShowPvsSizes(bool);
+	void SetTopView(bool);
+	void SetCutViewCells(bool);
+	void SetCutScene(bool);
+
+
+};
+
 
 class __declspec(dllexport) QtGlRendererWidget : public QGLWidget, public GlRendererWidget
 {
-  Q_OBJECT
-public:
-
-  // point of the last mouse click used for movement in the scene
-  Vector3 mousePoint;
-
-  bool mTopView;
-  bool mRenderViewCells;
-  bool mCutViewCells;
-  bool mCutScene;
-  bool mRenderErrors;
-  bool mRenderFilter;
-  bool mUseFilter;
-  bool mUseSpatialFilter;
-  bool mShowRenderCost;
-  
-  bool mShowPvsSizes;
-  float mSpatialFilterSize;
-  
-  Plane3 mSceneCutPlane;
-  float mTopDistance;
-
-  // some statistics
-  int mPvsSize;
-  float mRenderError;
-
-  QtRendererControlWidget *mControlWidget;
-  
-  QtGlRendererWidget(SceneGraph *sceneGraph,
-				   ViewCellsManager *viewcells,
-				   KdTree *tree,
-				   QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WFlags f = 0
-				   );
-
-  QtGlRendererWidget() {};
-
-  virtual void SetupCamera();
-
-  void initializeGL() {
-	InitGL();
-  }
-  void resizeGL(int w, int h);
-  void paintGL();
-  void timerEvent(QTimerEvent *) {
-	  update();
-  }
-
-  void mousePressEvent(QMouseEvent *);
-  void mouseReleaseEvent(QMouseEvent *);
-  void mouseMoveEvent(QMouseEvent *);
-
-  void keyPressEvent ( QKeyEvent * e ) ;
-
-  void
-  RenderPvs();
-
-  float
-  RenderErrors();
-  void
-  RenderInfo();
-
-  virtual int GetWidth() const { return width(); }
-  virtual int GetHeight() const { return height(); }
-
- virtual void
-  SetupProjection(const int w, const int h, const float angle = 70.0f);
-
-  void
-  RenderViewCells();
-
- public slots:
-
- void SetRenderErrors(bool b) {
-   mRenderErrors = b;
-   updateGL();
- }
-
- void SetRenderFilter(bool b) {
-   mRenderFilter = b;
-   updateGL();
- }
-
-  void SetUseFilter(bool b) {
-   mUseFilter = b;
-   updateGL();
- }
-
-  void SetUseSpatialFilter(bool b) {
-	mUseSpatialFilter = b;
-	updateGL();
-  }
-
-  
-  void
-  SetViewCellGranularity(int number);
-  
-  void
-  SetVisibilityFilterSize(int number);
-
-  void
-  SetSpatialFilterSize(int number);
-  
-  void
-  SetSceneCut(int cut);
-  
-  void
-  SetTopDistance(int dist);
-  
-  void SetShowViewCells(bool b) {
-	mRenderViewCells = b;
-	updateGL();
-  }
-
-  void SetShowRenderCost(bool b) {
-	mShowRenderCost = b;
-	updateGL();
-  }
-
-  void SetShowPvsSizes(bool b) {
-	mShowPvsSizes = b;
-	updateGL();
-  }
-
-  void SetTopView(bool b) {
-	mTopView = b;
-	updateGL();
-  }
-
-  void SetCutViewCells(bool b) {
-	mCutViewCells = b;
-	updateGL();
-  }
-  void SetCutScene(bool b) {
-	mCutScene = b;
-	updateGL();
-  }
-
+	Q_OBJECT
+public:
+
+	// point of the last mouse click used for movement in the scene
+	Vector3 mousePoint;
+
+	bool mTopView;
+	bool mRenderViewCells;
+	bool mCutViewCells;
+	bool mCutScene;
+	bool mRenderErrors;
+	bool mRenderFilter;
+	bool mUseFilter;
+	bool mUseSpatialFilter;
+	bool mShowRenderCost;
+
+	bool mShowPvsSizes;
+	float mSpatialFilterSize;
+
+	Plane3 mSceneCutPlane;
+	float mTopDistance;
+
+	// some statistics
+	int mPvsSize;
+	float mRenderError;
+
+	QtRendererControlWidget *mControlWidget;
+
+	QtGlRendererWidget(SceneGraph *sceneGraph,
+		ViewCellsManager *viewcells,
+		KdTree *tree,
+		QWidget * parent = 0, const QGLWidget * shareWidget = 0, Qt::WFlags f = 0
+		);
+
+	QtGlRendererWidget() {};
+
+	virtual void SetupCamera();
+
+	void initializeGL() {
+		InitGL();
+	}
+	void resizeGL(int w, int h);
+	void paintGL();
+	void timerEvent(QTimerEvent *) {
+		update();
+	}
+
+	void mousePressEvent(QMouseEvent *);
+	void mouseReleaseEvent(QMouseEvent *);
+	void mouseMoveEvent(QMouseEvent *);
+
+	void keyPressEvent ( QKeyEvent * e ) ;
+
+	void
+		RenderPvs();
+
+	float
+		RenderErrors();
+	void
+		RenderInfo();
+
+	virtual int GetWidth() const { return width(); }
+	virtual int GetHeight() const { return height(); }
+
+	virtual void
+		SetupProjection(const int w, const int h, const float angle = 70.0f);
+
+	void
+		RenderViewCells();
+
+public slots:
+
+	void SetRenderErrors(bool b) {
+		mRenderErrors = b;
+		updateGL();
+	}
+
+	void SetRenderFilter(bool b) {
+		mRenderFilter = b;
+		updateGL();
+	}
+
+	void SetUseFilter(bool b) {
+		mUseFilter = b;
+		updateGL();
+	}
+
+	void SetUseSpatialFilter(bool b) {
+		mUseSpatialFilter = b;
+		updateGL();
+	}
+
+
+	void
+		SetViewCellGranularity(int number);
+
+	void
+		SetVisibilityFilterSize(int number);
+
+	void
+		SetSpatialFilterSize(int number);
+
+	void
+		SetSceneCut(int cut);
+
+	void
+		SetTopDistance(int dist);
+
+	void SetShowViewCells(bool b) {
+		mRenderViewCells = b;
+		updateGL();
+	}
+
+	void SetShowRenderCost(bool b) {
+		mShowRenderCost = b;
+		updateGL();
+	}
+
+	void SetShowPvsSizes(bool b) {
+		mShowPvsSizes = b;
+		updateGL();
+	}
+
+	void SetTopView(bool b) {
+		mTopView = b;
+		updateGL();
+	}
+
+	void SetCutViewCells(bool b) {
+		mCutViewCells = b;
+		updateGL();
+	}
+	void SetCutScene(bool b) {
+		mCutScene = b;
+		updateGL();
+	}
+
+	// matt: dummy file
+	void RenderRenderCost() {}
 
 };
@@ -306,26 +306,27 @@
 	Q_OBJECT
 public:
-    QtGlDebuggerWidget(QtGlRendererBuffer *buf, QWidget *parent = NULL);
-    ~QtGlDebuggerWidget();
-    void initializeGL();
-    void resizeGL(int w, int h);
-    void paintGL();
-    void timerEvent(QTimerEvent *) { update(); }
-    void mousePressEvent(QMouseEvent *) { killTimer(timerId); }
-    void mouseReleaseEvent(QMouseEvent *) { timerId = startTimer(20); }
-
-    void initCommon();
-    void initPbuffer();
-
-  
-	 QtGlRendererBuffer *mRenderBuffer;
-
-	 Beam mBeam;
-	 int mSamples;
-	 Intersectable *mSourceObject;
+	QtGlDebuggerWidget(QtGlRendererBuffer *buf, QWidget *parent = NULL);
+	~QtGlDebuggerWidget();
+	void initializeGL();
+	void resizeGL(int w, int h);
+	void paintGL();
+	void timerEvent(QTimerEvent *) { update(); }
+	void mousePressEvent(QMouseEvent *) { killTimer(timerId); }
+	void mouseReleaseEvent(QMouseEvent *) { timerId = startTimer(20); }
+
+	void initCommon();
+	void initPbuffer();
+
+
+	QtGlRendererBuffer *mRenderBuffer;
+
+	Beam mBeam;
+	int mSamples;
+	Intersectable *mSourceObject;
 
 private:
-    GLuint dynamicTexture;
-    int timerId;
+
+	GLuint dynamicTexture;
+	int timerId;
 };
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.sln
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.sln	(revision 1252)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlRenderer.sln	(revision 1926)
@@ -8,4 +8,5 @@
 		Debug = Debug
 		Release = Release
+		release_internal = release_internal
 	EndGlobalSection
 	GlobalSection(ProjectConfiguration) = postSolution
@@ -14,4 +15,6 @@
 		{B85DC7B1-58B6-4912-BD64-8B452630A368}.Release.ActiveCfg = Release|Win32
 		{B85DC7B1-58B6-4912-BD64-8B452630A368}.Release.Build.0 = Release|Win32
+		{B85DC7B1-58B6-4912-BD64-8B452630A368}.release_internal.ActiveCfg = release_internal|Win32
+		{B85DC7B1-58B6-4912-BD64-8B452630A368}.release_internal.Build.0 = release_internal|Win32
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlViewer.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlViewer.cpp	(revision 1926)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlRenderer/QtGlViewer.cpp	(revision 1926)
@@ -0,0 +1,187 @@
+// ===================================================================
+// $Id$
+
+// Qt headers
+#include <QtGui>
+#include <QtOpenGL>
+
+// C++ standard headers
+//#include <cmath>
+
+// local headers
+#include "common.h"
+#include "QtGlViewer.h"
+#include "QtGlRenderer.h"
+#include "Trackball.h"
+#include "RssPreprocessor.h"
+#include "SceneGraph.h"
+
+
+namespace GtpVisibilityPreprocessor {
+
+QtGlRendererWidget *renderer;
+
+QtGlViewer::QtGlViewer(QWidget *parent,
+					   QtGlRendererWidget *renderer):
+  QGLWidget(parent), mRenderer(renderer)
+{
+	scale = 1.0f;
+	mWireframe = false;
+	trackball(manipulatorLastQuat, 0.0f, 0.0f, 0.0f, 0.0f);
+	connect(renderer, SIGNAL(PvsUpdated()), this, SLOT(updateGL()));
+}
+  
+QSize
+QtGlViewer::minimumSizeHint() const
+{
+  return QSize(100, 100);
+}
+
+QSize
+QtGlViewer::sizeHint() const {
+  return QSize(500, 500);
+}
+  
+// This method has to be rendefined by all renderer implementations
+void
+QtGlViewer::RenderScene()
+{
+	mRenderer->mFrame++;
+	
+	// render into the right side of the window buffer
+	if (mRenderer->mRenderViewCells) 
+	  mRenderer->RenderViewCells();
+	
+	mRenderer->RenderPvs();
+	
+// 	if (mRenderer->mShowRays) {
+// 	  RssPreprocessor *p = (RssPreprocessor *)
+// 			mRenderer->mViewCellsManager->GetPreprocessor();
+// 	  if (p->mRssTree) {
+// 			VssRayContainer rays;
+// 			p->mRssTree->CollectRays(rays, 10000);
+// 			mRenderer->RenderRays(rays);
+// 	  }
+// 	}
+	
+	if (mRenderer->mShowRenderCost) 
+	  mRenderer->RenderRenderCost();
+
+	glColor3f(1.0f, 1.0f, 1.0f);
+	mRenderer->RenderInfo();
+}
+
+
+void
+QtGlViewer::initializeGL()
+{  
+  const char *vendorString, *rendererString, *versionString, *extString;
+
+  // get GL info
+  vendorString = (const char *) glGetString(GL_VENDOR);
+  rendererString = (const char *) glGetString(GL_RENDERER);
+  versionString = (const char *) glGetString(GL_VERSION);
+  extString = (const char *) glGetString(GL_EXTENSIONS);
+  
+  Debug << "Info: GL Vendor = "<<vendorString<<endl
+        << "Info: GL Renderer = "<<rendererString<<endl
+        << "Info: GL Version = "<<versionString<<endl
+        << "Info: GL Extensions = "<<extString<<endl<<flush;
+
+
+  return;
+}
+
+void
+QtGlViewer::paintGL()
+{
+  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+  glLoadIdentity();
+
+  float m[4][4];
+
+  glLoadIdentity();
+  gluLookAt(0.0, 0.0, 1.0,  /* eye is at (0,0,30) */
+						0.0, 0.0, 0.0,      /* center is at (0,0,0) */
+						0.0, 1.0, 0.);      /* up is in positive Y direction */
+  
+  build_rotmatrix(m, manipulatorLastQuat);
+  glMultMatrixf(&m[0][0]);
+
+  float s = scale*20.0f/Magnitude(mRenderer->mSceneGraph->GetBox().Diagonal());
+  glScalef(s, s, s);
+  
+  Vector3 t = -mRenderer->mSceneGraph->GetBox().Center();
+  glTranslatef(t.x, t.y, t.z);
+
+	RenderScene();
+}
+
+void
+QtGlViewer::resizeGL(int width, int height)
+{
+  glViewport(0, 0, width, height);
+  
+  glMatrixMode(GL_PROJECTION);
+  glLoadIdentity();
+  gluPerspective(70.0, 1.0, 0.1, 100.0);
+  //  glOrtho(-0.5*width/height, +0.5*width/height, 0.5, -0.5, 4.0, 15.0);
+  glMatrixMode(GL_MODELVIEW);
+}
+
+
+void
+QtGlViewer::mousePressEvent(QMouseEvent *event)
+{
+  lastPos = event->pos();
+}
+
+void
+QtGlViewer::keyPressEvent ( QKeyEvent * e )
+{
+  switch (e->key()) {
+  case Qt::Key_W:
+		mWireframe  = !mWireframe;
+		updateGL();
+  default:
+		e->ignore();
+		break;
+  }
+  updateGL();
+}
+
+void
+QtGlViewer::mouseMoveEvent(QMouseEvent *event)
+{
+  int dx = event->x() - lastPos.x();
+  int dy = event->y() - lastPos.y();  
+  
+  if (event->modifiers() & Qt::CTRL)
+		{
+			scale = scale*(1.0f - dy/(float)height());
+			if (scale < 0.01)
+				scale = 0.01;
+			updateGL();
+		}
+  else {
+		float W = width();
+		float H = height();
+		int x = event->x();
+		int lastX = lastPos.x();
+		int y = event->y();
+		int lastY = lastPos.y();
+	
+		float quat[4];
+		trackball(quat,
+							(2.0 * lastX - W) / W,
+							(H - 2.0 * lastY) / H,
+							(2.0 * x - W) / W,
+							(H - 2.0 * y) / H
+							);
+		add_quats(quat, manipulatorLastQuat, manipulatorLastQuat);
+  }
+  
+  lastPos = event->pos();
+updateGL();
+}
+}
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 1924)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 1926)
@@ -133,5 +133,6 @@
 mSceneGraph(NULL),
 mRayCaster(NULL),
-mStopComputation(false)
+mStopComputation(false),
+mThread(NULL)
 {
 	Environment::GetSingleton()->GetBoolValue("Preprocessor.useGlRenderer", mUseGlRenderer);
@@ -139,7 +140,4 @@
 	// renderer will be constructed when the scene graph and viewcell manager will be known
 	renderer = NULL;
-	
-	Environment::GetSingleton()->GetBoolValue("Preprocessor.delayVisibilityComputation",
-											  mDelayVisibilityComputation);
 	
 	Environment::GetSingleton()->GetBoolValue("Preprocessor.useGlDebugger", mUseGlDebugger);
@@ -230,4 +228,16 @@
 	filenames.push_back(string(str, pos, str.size() - pos));
 	return (int)filenames.size();
+}
+
+
+void Preprocessor::SetThread(PreprocessorThread *t)
+{
+	mThread = t;
+}
+
+
+PreprocessorThread *Preprocessor::GetThread() const 
+{
+	return mThread;
 }
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj	(revision 1894)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj	(revision 1926)
@@ -302,4 +302,57 @@
 				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
 		</Configuration>
+		<Configuration
+			Name="Release_qt|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="2">
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="3"
+				GlobalOptimizations="TRUE"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="TRUE"
+				FavorSizeOrSpeed="1"
+				OmitFramePointers="TRUE"
+				EnableFiberSafeOptimizations="TRUE"
+				OptimizeForProcessor="0"
+				OptimizeForWindowsApplication="TRUE"
+				AdditionalIncludeDirectories="..\include;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;USE_QT"
+				ExceptionHandling="TRUE"
+				RuntimeLibrary="2"
+				DisableLanguageExtensions="FALSE"
+				ForceConformanceInForLoopScope="FALSE"
+				RuntimeTypeInfo="TRUE"
+				UsePrecompiledHeader="0"
+				BrowseInformation="1"
+				WarningLevel="2"
+				Detect64BitPortabilityProblems="TRUE"
+				DebugInformationFormat="3"/>
+			<Tool
+				Name="VCCustomBuildTool"/>
+			<Tool
+				Name="VCLibrarianTool"
+				OutputFile="..\lib\Release\$(ProjectName).lib"/>
+			<Tool
+				Name="VCMIDLTool"/>
+			<Tool
+				Name="VCPostBuildEventTool"/>
+			<Tool
+				Name="VCPreBuildEventTool"/>
+			<Tool
+				Name="VCPreLinkEventTool"/>
+			<Tool
+				Name="VCResourceCompilerTool"/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"/>
+			<Tool
+				Name="VCManagedWrapperGeneratorTool"/>
+			<Tool
+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+		</Configuration>
 	</Configurations>
 	<References>
@@ -586,4 +639,12 @@
 						Outputs=""/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release_qt|Win32">
+					<Tool
+						Name="VCCustomBuildTool"
+						Description=""
+						CommandLine=""
+						Outputs=""/>
+				</FileConfiguration>
 			</File>
 			<File
@@ -638,4 +699,12 @@
 						Outputs=""/>
 				</FileConfiguration>
+				<FileConfiguration
+					Name="Release_qt|Win32">
+					<Tool
+						Name="VCCustomBuildTool"
+						Description=""
+						CommandLine=""
+						Outputs=""/>
+				</FileConfiguration>
 			</File>
 			<File
@@ -734,4 +803,10 @@
 			<File
 				RelativePath="..\src\Tetrahedron3.h">
+			</File>
+			<File
+				RelativePath=".\Trackball.cpp">
+			</File>
+			<File
+				RelativePath=".\Trackball.h">
 			</File>
 			<File
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp	(revision 1900)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/RssPreprocessor.cpp	(revision 1926)
@@ -40,6 +40,6 @@
   Environment::GetSingleton()->GetBoolValue("RssPreprocessor.Export.pvs", mExportPvs);
   Environment::GetSingleton()->GetBoolValue("RssPreprocessor.Export.rssTree", mExportRssTree);
-  Environment::GetSingleton()->GetBoolValue("RssPreprocessor.Export.rays", mExportRays);
-  Environment::GetSingleton()->GetIntValue("RssPreprocessor.Export.numRays", mExportNumRays);
+  //Environment::GetSingleton()->GetBoolValue("RssPreprocessor.Export.rays", mExportRays);
+  //Environment::GetSingleton()->GetIntValue("RssPreprocessor.Export.numRays", mExportNumRays);
   Environment::GetSingleton()->GetBoolValue("RssPreprocessor.useViewcells", mUseViewcells);
   Environment::GetSingleton()->GetBoolValue("RssPreprocessor.objectBasedSampling", mObjectBasedSampling);
@@ -427,5 +427,7 @@
   }
   
-  
+  if (!GetThread())
+	  cerr << "!!no thread available!" << endl;
+
   cout<<"COMPUTATION THREAD="<<GetThread()->GetCurrentThreadId()<<endl<<flush;
   
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 1900)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 1926)
@@ -111,5 +111,5 @@
 	*/
 	bool LoadSamples(VssRayContainer &samples,
-					 ObjectContainer &objects) const;
+		ObjectContainer &objects) const;
 
 	/** Exports samples to file.
@@ -121,18 +121,18 @@
 	bool ExportKdTree(const string filename);
 
-  virtual bool
-  ExportRays(const char *filename,
-			 const VssRayContainer &vssRays,
-			 const int number
-			 );
-	
+	virtual bool
+		ExportRays(const char *filename,
+		const VssRayContainer &vssRays,
+		const int number
+		);
+
 	virtual int
-	GenerateRays(const int number,
-				 SamplingStrategy &strategy,
-				 SimpleRayContainer &rays);
-
-  virtual int GenerateRays(const int number,
-						   const int raysType,
-						   SimpleRayContainer &rays);
+		GenerateRays(const int number,
+		SamplingStrategy &strategy,
+		SimpleRayContainer &rays);
+
+	virtual int GenerateRays(const int number,
+		const int raysType,
+		SimpleRayContainer &rays);
 
 	bool GenerateRayBundle(SimpleRayContainer &rayBundle,
@@ -142,7 +142,7 @@
 
 	virtual void CastRays(SimpleRayContainer &rays,
-						  VssRayContainer &vssRays,
-						  const bool castDoubleRays,
-						  const bool pruneInvalidRays = true);
+		VssRayContainer &vssRays,
+		const bool castDoubleRays,
+		const bool pruneInvalidRays = true);
 
 	/** Returns a view cells manager of the given name.
@@ -157,5 +157,16 @@
 
 	Intersectable *GetParentObject(const int index) const;
-Vector3 GetParentNormal(const int index) const;
+	Vector3 GetParentNormal(const int index) const;
+
+	/** Sets a Preprocessor thread.
+	*/
+	void SetThread(PreprocessorThread *t);
+
+	/** Returns a Preprocessor thread.
+	*/
+	PreprocessorThread *GetThread() const;
+
+
+
 	////////////////////////////////////////////////
 
@@ -205,23 +216,15 @@
 	int mPass;
  
-    bool mDelayVisibilityComputation;
 	bool mStopComputation;
   
 	bool mExportObj;
 
-  bool mExportRays;
-  int mExportNumRays;
+	bool mExportRays;
+	int mExportNumRays;
 
 	ofstream mStats;
 
-  GlRendererBuffer *renderer;
-
-  void SetThread(PreprocessorThread *t) {
-	mThread = t;
-  }
-
-  PreprocessorThread *GetThread() const {
-	return mThread;
-  }
+	GlRendererBuffer *renderer;
+
 
 protected:
@@ -255,5 +258,5 @@
 	bool mUseViewSpaceBox;
 
-  PreprocessorThread *mThread;
+	PreprocessorThread *mThread;
 };
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.cpp	(revision 1867)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.cpp	(revision 1926)
@@ -61,8 +61,3 @@
 
 
-/*PreprocessorThread *PreprocessorThreadFactory::Create(const int threadType)
-{
-	return NULL;
-}*/
-
 }
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.h	(revision 1867)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/PreprocessorThread.h	(revision 1926)
@@ -15,28 +15,40 @@
 {
 public:
-  static vector<PreprocessorThread *> sThreads;
-  
-  PreprocessorThread(Preprocessor *p);
-  virtual ~PreprocessorThread();
-  
-  virtual void InitThread() {
-	sThreads.push_back(this);
-  }
-  virtual void RunThread() {}
-  
-  virtual void Main();
+	static vector<PreprocessorThread *> sThreads;
 
-  // This function has to be defined by the thread library used...
-  virtual int GetCurrentThreadId() const = 0;
+	PreprocessorThread(Preprocessor *p);
+	virtual ~PreprocessorThread();
+
+	virtual void InitThread() 
+	{
+		sThreads.push_back(this);
+	}
+
+	virtual void RunThread() {}
+
+	virtual void Main();
+
+	// This function has to be defined by the thread library used...
+	virtual int GetCurrentThreadId() const = 0;
 
 protected:
-  
-  Preprocessor *mPreprocessor;
+
+	Preprocessor *mPreprocessor;
 };
 
-/*class PreprocessorThreadFactory
+
+class DummyPreprocessorThread: public PreprocessorThread
 {
-	PreprocessorThread *Create(const int threadType);
-}*/
+public:
+
+	DummyPreprocessorThread(Preprocessor *p): PreprocessorThread(p)
+	{}
+	
+	// This function has to be defined by the thread library used...
+	virtual int GetCurrentThreadId() const
+	{
+		return 0;
+	}
+};
 
 }
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 1903)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp	(revision 1926)
@@ -1,4 +1,4 @@
-#ifdef GTP_INTERNAL
-#ifndef NO_QT
+/*#ifdef GTP_INTERNAL
+#ifndef USE_QT
 #define USE_QT 1
 #else
@@ -6,6 +6,7 @@
 #endif
 #endif
-
-#define USE_THREADS 1
+*/
+
+#define USE_THREADS 0
 
 #ifdef UNICODE
@@ -28,8 +29,14 @@
 #include "SceneGraph.h"
 
-
-
-#if !USE_QT && USE_THREADS
-#include "BoostPreprocessorThread.h"
+#include "ViewCellsManager.h"
+
+#ifdef USE_QT  
+	#include "QtPreprocessorThread.h"
+	#include "QtGlViewer.h"
+	#include "QtGlRenderer.h"
+#else
+	#if USE_THREADS
+		#include "BoostPreprocessorThread.h"
+	#endif
 #endif
 
@@ -37,9 +44,4 @@
 #include "GlRenderer.h"
 
-#ifndef NO_QT
-#include "QtPreprocessorThread.h"
-#include "QtGlRenderer.h"
-#include "QtGlViewer.h"
-#endif
 
 #define USE_EXE_PATH false
@@ -152,9 +154,8 @@
 }
 
-#include "ViewCellsManager.h"
+
 int
 main(int argc, char **argv)
 {
-
 	//Now just call this function at the start of your program and if you're
 	//compiling in debug mode (F5), any leaks will be displayed in the Output
@@ -169,5 +170,5 @@
 
 	int returnCode = 0;
-	
+
 	InitTiming();
 
@@ -177,5 +178,4 @@
 	MeshKdTree::ParseEnvironment();
 
-	
 	char buff[128];
 	Environment::GetSingleton()->GetStringValue("Preprocessor.type", buff);
@@ -189,5 +189,4 @@
 	}
 
-
 	/////////////
 	//-- load scene 
@@ -203,5 +202,5 @@
 		exit(1);
 	}
-
+	
 	const string externKdTree = ReplaceSuffix(filename, ".obj", ".kdf");
 	const string internKdTree = GetInternFilename(filename, preprocessor->mLoadMeshes ? ".kdm" : ".kdt");
@@ -212,5 +211,5 @@
 	if (preprocessor->InitRayCast(externKdTree, internKdTree))
 	{
-		cout << "ray casting initialized! here6" << endl;
+		cout << "ray casting initialized!" << endl;
 	}
 	else
@@ -221,5 +220,4 @@
 	}
 
-	
 	// export objects as obj
 	if (preprocessor->mExportObj)
@@ -248,95 +246,102 @@
 	}
 	
-	cout<<"here34"<<endl;
 	// parse view cells related options
 	if (!preprocessor->PrepareViewCells())
 	{
+		cerr << "error: view cells could not be loaded" << endl;
+
 		Cleanup();
 		exit(1);
 	}
 	
-	if (0) 
-	{
-		preprocessor->Export(filename + "-out.x3d", true, false);
-		preprocessor->Export(filename + "-kdtree.x3d", false, true);	
-	}
-
 	// create a preprocessor thread (note: capsulates calls to boost fuctions!)
-	//PreprocessorThread *pt = PreprocessorThreadFactory::Create(preprocessor);
-	PreprocessorThread *pt;
-
-#if USE_QT
+	PreprocessorThread *pt = NULL;
+
+#ifdef USE_QT
+	
 	// create a qt application first (must be created before any opengl widget ...)
 	QApplication *app = new QApplication(argc, NULL);
-	
+
 	pt = new QtPreprocessorThread(preprocessor);
+
 #else
-#if USE_THREADS
-	pt = new BoostPreprocessorThread(preprocessor);
-#else
-	pt = new PreprocessorThread(preprocessor);
-#endif
-#endif
+
+	//#if USE_THREADS
+	//	pt = new BoostPreprocessorThread(preprocessor);
+	//#else
+		// use a dummy thread
+		pt = new DummyPreprocessorThread(preprocessor);
+	//#endif
+#endif
+
+	preprocessor->SetThread(pt);
 
 	bool guiSupported = false;
-
+	
 	if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger)
-	  {
+	{
+#ifdef USE_QT
 		cout << "using gl widget" << endl;
 		// create and run the preprocessor application in a parallel thread
-#if 0//USE_QT		
-#if USE_THREADS
+		
 		pt->InitThread();
-		if (!preprocessor->mDelayVisibilityComputation)
-		  pt->RunThread();
-#endif
-		
+		pt->RunThread();
+
 		// display the render widget
 		if (!rendererWidget) 
 		{
-		  if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) {
-			QMessageBox::information(0, "OpenGL pbuffers", 
-									 "This system does not support OpenGL/pbuffers.",
-									 QMessageBox::Ok);
-			return NULL;
-		  }
-		  
-		  rendererWidget = new QtGlRendererWidget(preprocessor->mSceneGraph,
-												  preprocessor->mViewCellsManager,
-												  preprocessor->mKdTree);
-			
-		  //((QtGlRendererWidget *)rendererWidget)->SetThread((QtPreprocessorThread *)pt);
-		  rendererWidget->Show();
-
-		  QtGlViewer *viewer = new QtGlViewer(NULL,
-											(QtGlRendererWidget *)
-											rendererWidget);
-		  viewer->show();
-		  guiSupported = true; 
+			if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) {
+				QMessageBox::information(0, "OpenGL pbuffers", 
+					"This system does not support OpenGL/pbuffers.",
+					QMessageBox::Ok);
+				return NULL;
+			}
+
+			rendererWidget = 
+				new QtGlRendererWidget(preprocessor->mSceneGraph,
+									   preprocessor->mViewCellsManager,
+									   preprocessor->mKdTree);
+
+			rendererWidget->Show();
+
+			QtGlViewer *viewer = 
+				new QtGlViewer(NULL, (QtGlRendererWidget *)rendererWidget);
+
+			viewer->show();
+			guiSupported = true; 
 		}
 
 		int frames;
 		Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", frames);
-		if (frames) {
-		  // NOTE: render texture should be power of 2 and square
-		  // renderer must be initialised
-		  // $$matt
-		  preprocessor->renderer = 
-			new QtGlRendererBuffer(512, 512,
-								 preprocessor->mSceneGraph,
-								 preprocessor->mViewCellsManager,
-								 preprocessor->mKdTree);
-		  //		preprocessor->Getrenderer->makeCurrent();
-		}
+		
+		if (frames) 
+		{
+			// NOTE: render texture should be power of 2 and square
+			// renderer must be initialised
+			// $$matt
+			preprocessor->renderer = 
+				new QtGlRendererBuffer(512, 512,
+									   preprocessor->mSceneGraph,
+									   preprocessor->mViewCellsManager,
+									   preprocessor->mKdTree);
+		}
+
 		qApp->exec();
 #endif
-	  }
-
-	if (!guiSupported) {
-	  preprocessor->mUseGlRenderer = false;
-	  preprocessor->mUseGlDebugger = false;
-	}
-
-	if (!(preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger)) {
+	}
+
+	// no gui available
+	if (!guiSupported) 
+	{
+		cout << "warning: gui not supported!" << endl;
+		
+		preprocessor->mUseGlRenderer = false;
+		preprocessor->mUseGlDebugger = false;
+	}
+
+	if (!(preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger)) 
+	{
+		cout << "executing main thread" << endl;
+
 		// just call the mail method -> will be executed in the main thread
 		pt->Main();
@@ -345,5 +350,5 @@
 	// release memory
 	Cleanup();
-	
+
 	return returnCode;
 }
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/QtPreprocessorThread.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtPreprocessorThread.h	(revision 1867)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/QtPreprocessorThread.h	(revision 1926)
@@ -2,5 +2,6 @@
 #define __QT_PREPROCESSOR_THREAD_H
 
-#ifndef NO_QT
+#ifdef USE_QT
+
 #include <QThread>
 #include "PreprocessorThread.h"
@@ -13,25 +14,25 @@
 {
 public:
-  QtPreprocessorThread(Preprocessor *p, QObject *parent = 0);
-  ~QtPreprocessorThread();
-  
-  void InitThread() {
-	PreprocessorThread::InitThread();
-  }
-  void RunThread() {
-	start(QThread::LowPriority);
-  }
+	QtPreprocessorThread(Preprocessor *p, QObject *parent = 0);
+	~QtPreprocessorThread();
 
-  // This function has to be defined by the thread library used...
-  virtual int GetCurrentThreadId() const;
+	void InitThread() {
+		PreprocessorThread::InitThread();
+	}
+	void RunThread() {
+		start(QThread::LowPriority);
+	}
 
-  
+	// This function has to be defined by the thread library used...
+	virtual int GetCurrentThreadId() const;
+
 protected:
-  void run() {
-	Main();
-  }
+	void run() {
+		Main();
+	}
 };
 
 }
+
 #endif
 #endif
Index: P/trunk/Lib/Vis/Preprocessing/src/QtGlViewer.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlViewer.cpp	(revision 1833)
+++ 	(revision )
@@ -1,187 +1,0 @@
-// ===================================================================
-// $Id$
-
-// Qt headers
-#include <QtGui>
-#include <QtOpenGL>
-
-// C++ standard headers
-#include <cmath>
-
-// local headers
-#include "common.h"
-#include "QtGlViewer.h"
-#include "QtGlRenderer.h"
-#include "Trackball.h"
-#include "RssPreprocessor.h"
-#include "SceneGraph.h"
-
-
-namespace GtpVisibilityPreprocessor {
-
-QtGlRendererWidget *renderer;
-
-QtGlViewer::QtGlViewer(QWidget *parent,
-					   QtGlRendererWidget *renderer):
-  QGLWidget(parent), mRenderer(renderer)
-{
-	scale = 1.0f;
-	mWireframe = false;
-	trackball(manipulatorLastQuat, 0.0f, 0.0f, 0.0f, 0.0f);
-	connect(renderer, SIGNAL(PvsUpdated()), this, SLOT(updateGL()));
-}
-  
-QSize
-QtGlViewer::minimumSizeHint() const
-{
-  return QSize(100, 100);
-}
-
-QSize
-QtGlViewer::sizeHint() const {
-  return QSize(500, 500);
-}
-  
-// This method has to be rendefined by all renderer implementations
-void
-QtGlViewer::RenderScene()
-{
-	mRenderer->mFrame++;
-	
-	// render into the right side of the window buffer
-	if (mRenderer->mRenderViewCells) 
-	  mRenderer->RenderViewCells();
-	
-	mRenderer->RenderPvs();
-	
-// 	if (mRenderer->mShowRays) {
-// 	  RssPreprocessor *p = (RssPreprocessor *)
-// 			mRenderer->mViewCellsManager->GetPreprocessor();
-// 	  if (p->mRssTree) {
-// 			VssRayContainer rays;
-// 			p->mRssTree->CollectRays(rays, 10000);
-// 			mRenderer->RenderRays(rays);
-// 	  }
-// 	}
-	
-	if (mRenderer->mShowRenderCost) 
-	  mRenderer->RenderRenderCost();
-
-	glColor3f(1.0f, 1.0f, 1.0f);
-	mRenderer->RenderInfo();
-}
-
-
-void
-QtGlViewer::initializeGL()
-{  
-  const char *vendorString, *rendererString, *versionString, *extString;
-
-  // get GL info
-  vendorString = (const char *) glGetString(GL_VENDOR);
-  rendererString = (const char *) glGetString(GL_RENDERER);
-  versionString = (const char *) glGetString(GL_VERSION);
-  extString = (const char *) glGetString(GL_EXTENSIONS);
-  
-  Debug << "Info: GL Vendor = "<<vendorString<<endl
-        << "Info: GL Renderer = "<<rendererString<<endl
-        << "Info: GL Version = "<<versionString<<endl
-        << "Info: GL Extensions = "<<extString<<endl<<flush;
-
-
-  return;
-}
-
-void
-QtGlViewer::paintGL()
-{
-  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-  glLoadIdentity();
-
-  float m[4][4];
-
-  glLoadIdentity();
-  gluLookAt(0.0, 0.0, 1.0,  /* eye is at (0,0,30) */
-						0.0, 0.0, 0.0,      /* center is at (0,0,0) */
-						0.0, 1.0, 0.);      /* up is in positive Y direction */
-  
-  build_rotmatrix(m, manipulatorLastQuat);
-  glMultMatrixf(&m[0][0]);
-
-  float s = scale*20.0f/Magnitude(mRenderer->mSceneGraph->GetBox().Diagonal());
-  glScalef(s, s, s);
-  
-  Vector3 t = -mRenderer->mSceneGraph->GetBox().Center();
-  glTranslatef(t.x, t.y, t.z);
-
-	RenderScene();
-}
-
-void
-QtGlViewer::resizeGL(int width, int height)
-{
-  glViewport(0, 0, width, height);
-  
-  glMatrixMode(GL_PROJECTION);
-  glLoadIdentity();
-  gluPerspective(70.0, 1.0, 0.1, 100.0);
-  //  glOrtho(-0.5*width/height, +0.5*width/height, 0.5, -0.5, 4.0, 15.0);
-  glMatrixMode(GL_MODELVIEW);
-}
-
-
-void
-QtGlViewer::mousePressEvent(QMouseEvent *event)
-{
-  lastPos = event->pos();
-}
-
-void
-QtGlViewer::keyPressEvent ( QKeyEvent * e )
-{
-  switch (e->key()) {
-  case Qt::Key_W:
-		mWireframe  = !mWireframe;
-		updateGL();
-  default:
-		e->ignore();
-		break;
-  }
-  updateGL();
-}
-
-void
-QtGlViewer::mouseMoveEvent(QMouseEvent *event)
-{
-  int dx = event->x() - lastPos.x();
-  int dy = event->y() - lastPos.y();  
-  
-  if (event->modifiers() & Qt::CTRL)
-		{
-			scale = scale*(1.0f - dy/(float)height());
-			if (scale < 0.01)
-				scale = 0.01;
-			updateGL();
-		}
-  else {
-		float W = width();
-		float H = height();
-		int x = event->x();
-		int lastX = lastPos.x();
-		int y = event->y();
-		int lastY = lastPos.y();
-	
-		float quat[4];
-		trackball(quat,
-							(2.0 * lastX - W) / W,
-							(H - 2.0 * lastY) / H,
-							(2.0 * x - W) / W,
-							(H - 2.0 * y) / H
-							);
-		add_quats(quat, manipulatorLastQuat, manipulatorLastQuat);
-  }
-  
-  lastPos = event->pos();
-updateGL();
-}
-}
Index: P/trunk/Lib/Vis/Preprocessing/src/QtGlViewer.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/QtGlViewer.h	(revision 1833)
+++ 	(revision )
@@ -1,54 +1,0 @@
-#ifndef __QTGLVIEWER_H
-#define __QTGLVIEWER_H
-
-#include <QtOpenGL>
-
-
-namespace GtpVisibilityPreprocessor {
-
-class QtGlRendererWidget;
-
-class QtGlViewer : public QGLWidget
-{
-	
-	Q_OBJECT
-
-	friend class QtGlRendererWidget;
-	friend class GlRenderer;
-
-public:
-	QtGlRendererWidget *mRenderer;
-	
-	QtGlViewer(QWidget *parent,
-						 QtGlRendererWidget *renderer);
-	
-  virtual ~QtGlViewer(){};
-  
-  QSize minimumSizeHint() const;
-  QSize sizeHint() const;
-  
-  // This method has to be rendefined by all renderer implementations
-  virtual void RenderScene();
-  
-protected:
-  void initializeGL();
-  void paintGL();
-  void resizeGL(int width, int height);
-  void mousePressEvent(QMouseEvent *event);
-  void mouseMoveEvent(QMouseEvent *event);
-
-	void keyPressEvent ( QKeyEvent * e );
-	
-  bool mWireframe;
-
-private:
-
-	float manipulatorLastQuat[4];
-  float scale;
-  QPoint lastPos;
-
-};
-
-}
-
-#endif
Index: /GTP/trunk/Lib/Vis/GtpVisibility.sln
===================================================================
--- /GTP/trunk/Lib/Vis/GtpVisibility.sln	(revision 1906)
+++ /GTP/trunk/Lib/Vis/GtpVisibility.sln	(revision 1926)
@@ -58,4 +58,5 @@
 		Release Static = Release Static
 		release_noqt = release_noqt
+		Release_qt = Release_qt
 		Unicode Debug = Unicode Debug
 		Unicode Release = Unicode Release
@@ -94,6 +95,8 @@
 		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Release Static.ActiveCfg = Release|Win32
 		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Release Static.Build.0 = Release|Win32
-		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.release_noqt.ActiveCfg = release_noqt|Win32
-		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.release_noqt.Build.0 = release_noqt|Win32
+		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.release_noqt.ActiveCfg = Release_qt|Win32
+		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.release_noqt.Build.0 = Release_qt|Win32
+		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Release_qt.ActiveCfg = Release_qt|Win32
+		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Release_qt.Build.0 = Release_qt|Win32
 		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Unicode Debug.ActiveCfg = Debug|Win32
 		{935D1BDD-41B0-49F1-A86C-EB49B94DDB20}.Unicode Debug.Build.0 = Debug|Win32
@@ -136,6 +139,8 @@
 		{101A7691-74F3-48B4-96A3-CF35578F5900}.Release Static.ActiveCfg = Release|Win32
 		{101A7691-74F3-48B4-96A3-CF35578F5900}.Release Static.Build.0 = Release|Win32
-		{101A7691-74F3-48B4-96A3-CF35578F5900}.release_noqt.ActiveCfg = release_noqt|Win32
-		{101A7691-74F3-48B4-96A3-CF35578F5900}.release_noqt.Build.0 = release_noqt|Win32
+		{101A7691-74F3-48B4-96A3-CF35578F5900}.release_noqt.ActiveCfg = Release_qt|Win32
+		{101A7691-74F3-48B4-96A3-CF35578F5900}.release_noqt.Build.0 = Release_qt|Win32
+		{101A7691-74F3-48B4-96A3-CF35578F5900}.Release_qt.ActiveCfg = Release_qt|Win32
+		{101A7691-74F3-48B4-96A3-CF35578F5900}.Release_qt.Build.0 = Release_qt|Win32
 		{101A7691-74F3-48B4-96A3-CF35578F5900}.Unicode Debug.ActiveCfg = Debug|Win32
 		{101A7691-74F3-48B4-96A3-CF35578F5900}.Unicode Debug.Build.0 = Debug|Win32
@@ -178,6 +183,8 @@
 		{7319E499-473D-4CE5-9983-725D6E68A55D}.Release Static.ActiveCfg = Release|Win32
 		{7319E499-473D-4CE5-9983-725D6E68A55D}.Release Static.Build.0 = Release|Win32
-		{7319E499-473D-4CE5-9983-725D6E68A55D}.release_noqt.ActiveCfg = release_noqt|Win32
-		{7319E499-473D-4CE5-9983-725D6E68A55D}.release_noqt.Build.0 = release_noqt|Win32
+		{7319E499-473D-4CE5-9983-725D6E68A55D}.release_noqt.ActiveCfg = Release_qt|Win32
+		{7319E499-473D-4CE5-9983-725D6E68A55D}.release_noqt.Build.0 = Release_qt|Win32
+		{7319E499-473D-4CE5-9983-725D6E68A55D}.Release_qt.ActiveCfg = Release_qt|Win32
+		{7319E499-473D-4CE5-9983-725D6E68A55D}.Release_qt.Build.0 = Release_qt|Win32
 		{7319E499-473D-4CE5-9983-725D6E68A55D}.Unicode Debug.ActiveCfg = Debug|Win32
 		{7319E499-473D-4CE5-9983-725D6E68A55D}.Unicode Debug.Build.0 = Debug|Win32
@@ -222,4 +229,6 @@
 		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.release_noqt.ActiveCfg = Release_Internal|Win32
 		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.release_noqt.Build.0 = Release_Internal|Win32
+		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Release_qt.ActiveCfg = Release_qt|Win32
+		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Release_qt.Build.0 = Release_qt|Win32
 		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Unicode Debug.ActiveCfg = Debug|Win32
 		{80DECC17-BDDD-4412-8CF8-F7C1C17A7436}.Unicode Debug.Build.0 = Debug|Win32
@@ -264,4 +273,6 @@
 		{EABCE292-D598-4600-A1C9-2591E7D62FDA}.release_noqt.ActiveCfg = release_noqt|Win32
 		{EABCE292-D598-4600-A1C9-2591E7D62FDA}.release_noqt.Build.0 = release_noqt|Win32
+		{EABCE292-D598-4600-A1C9-2591E7D62FDA}.Release_qt.ActiveCfg = Release_qt|Win32
+		{EABCE292-D598-4600-A1C9-2591E7D62FDA}.Release_qt.Build.0 = Release_qt|Win32
 		{EABCE292-D598-4600-A1C9-2591E7D62FDA}.Unicode Debug.ActiveCfg = Debug|Win32
 		{EABCE292-D598-4600-A1C9-2591E7D62FDA}.Unicode Debug.Build.0 = Debug|Win32
@@ -306,4 +317,6 @@
 		{69BC58F0-C7EB-4B43-B782-B6F047EF0528}.release_noqt.ActiveCfg = release_noqt|Win32
 		{69BC58F0-C7EB-4B43-B782-B6F047EF0528}.release_noqt.Build.0 = release_noqt|Win32
+		{69BC58F0-C7EB-4B43-B782-B6F047EF0528}.Release_qt.ActiveCfg = Release_qt|Win32
+		{69BC58F0-C7EB-4B43-B782-B6F047EF0528}.Release_qt.Build.0 = Release_qt|Win32
 		{69BC58F0-C7EB-4B43-B782-B6F047EF0528}.Unicode Debug.ActiveCfg = Debug|Win32
 		{69BC58F0-C7EB-4B43-B782-B6F047EF0528}.Unicode Debug.Build.0 = Debug|Win32
@@ -346,6 +359,8 @@
 		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release Static.ActiveCfg = Release|Win32
 		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release Static.Build.0 = Release|Win32
-		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.release_noqt.ActiveCfg = release_noqt|Win32
-		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.release_noqt.Build.0 = release_noqt|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.release_noqt.ActiveCfg = Release_qt|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.release_noqt.Build.0 = Release_qt|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release_qt.ActiveCfg = Release_qt|Win32
+		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Release_qt.Build.0 = Release_qt|Win32
 		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Unicode Debug.ActiveCfg = Debug|Win32
 		{248F19A6-2FE0-4F5D-8928-E0EA10609887}.Unicode Debug.Build.0 = Debug|Win32
@@ -388,6 +403,8 @@
 		{17F2C6F9-6101-430E-ABF4-71383868EF24}.Release Static.ActiveCfg = Release|Win32
 		{17F2C6F9-6101-430E-ABF4-71383868EF24}.Release Static.Build.0 = Release|Win32
-		{17F2C6F9-6101-430E-ABF4-71383868EF24}.release_noqt.ActiveCfg = release_noqt|Win32
-		{17F2C6F9-6101-430E-ABF4-71383868EF24}.release_noqt.Build.0 = release_noqt|Win32
+		{17F2C6F9-6101-430E-ABF4-71383868EF24}.release_noqt.ActiveCfg = Release_qt|Win32
+		{17F2C6F9-6101-430E-ABF4-71383868EF24}.release_noqt.Build.0 = Release_qt|Win32
+		{17F2C6F9-6101-430E-ABF4-71383868EF24}.Release_qt.ActiveCfg = Release_qt|Win32
+		{17F2C6F9-6101-430E-ABF4-71383868EF24}.Release_qt.Build.0 = Release_qt|Win32
 		{17F2C6F9-6101-430E-ABF4-71383868EF24}.Unicode Debug.ActiveCfg = Debug|Win32
 		{17F2C6F9-6101-430E-ABF4-71383868EF24}.Unicode Debug.Build.0 = Debug|Win32
