Index: GTP/trunk/App/Demos/Vis/CHC_revisited/Texture.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/Texture.cpp	(revision 2757)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/Texture.cpp	(revision 2758)
@@ -67,5 +67,5 @@
 
 	gluBuild2DMipmaps(GL_TEXTURE_2D, 3, mWidth, mHeight,
-						  GL_RGBA, GL_UNSIGNED_BYTE, mImage);
+					  GL_RGBA, GL_UNSIGNED_BYTE, mImage);
 
 	//glTexImage2D(GL_TEXTURE_2D, 0, 3, mWidth, mHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, mImage);
@@ -119,5 +119,4 @@
 
 int Texture::GetPixelSize() const
-
 {
 	if (mFormat == FORMAT_RGBA)
Index: GTP/trunk/App/Demos/Vis/CHC_revisited/chcdemo.cpp
===================================================================
--- GTP/trunk/App/Demos/Vis/CHC_revisited/chcdemo.cpp	(revision 2757)
+++ GTP/trunk/App/Demos/Vis/CHC_revisited/chcdemo.cpp	(revision 2758)
@@ -103,4 +103,5 @@
 void mouse(int button, int state, int x, int y);
 void leftMotion(int x, int y);
+void rightMotion(int x, int y);
 void middleMotion(int x, int y);
 void drawEyeView(void);
@@ -112,17 +113,9 @@
 
 
-void SetupProjection(int w, int h, float angle, const AxisAlignedBox3 &sceneBox)
-{
-	glViewport(0, 0, w, h);
-	glMatrixMode(GL_PROJECTION);
-	glLoadIdentity();
-
-	gluPerspective(angle, 1.0, 1.0f, 2.0 * Magnitude(sceneBox.Diagonal()));
-	glMatrixMode(GL_MODELVIEW);
-}
-
 
 int main(int argc, char* argv[])
 {
+	camera = new Camera(800, 600);
+
 	glutInitWindowSize(800, 600);
 	glutInit(&argc, argv);
@@ -149,6 +142,4 @@
 	const string filename("city.dem");
 
-	camera = new Camera(800, 600);
-
 	if (loader.Load(filename, sceneEntities))
 		cout << "scene " << filename << " loaded" << endl;
@@ -165,5 +156,5 @@
 	Debug << "scene box: " << sceneBox << endl;
 
-	SetupProjection(800, 600, 60, sceneBox);
+	//SetupProjection(800, 600, 60, sceneBox);
 	//camera->LookAtBox(sceneBox);
 	camera->LookInBox(sceneBox);
@@ -319,5 +310,5 @@
 void SetupEyeView(void)
 {
-	SetupProjection(800,600,60,sceneBox);
+	//SetupProjection(800,600,60,sceneBox);
 	glMatrixMode(GL_MODELVIEW);
 	camera->SetupCameraView();
@@ -624,7 +615,13 @@
 	winHeight = h;
 
-	if(w) winAspectRatio = (double) h / (double) w;
-
-	//perspectiveDeg(eyeProjection, 60.0, 1.0/winAspectRatio, nearDist, 150.0);
+	if (w) winAspectRatio = (double) h / (double) w;
+
+	glMatrixMode(GL_PROJECTION);
+	glLoadIdentity();
+
+	gluPerspective(60.0f, 1.0f / winAspectRatio, nearDist, 2.0 * Magnitude(sceneBox.Diagonal()));
+	glMatrixMode(GL_MODELVIEW);
+
+	//perspectiveDeg(eyeProjection, 60.0, 1.0f/winAspectRatio, nearDist, 150.0);
 
 	glutPostRedisplay();
@@ -634,5 +631,5 @@
 void mouse(int button, int state, int x, int y) 
 {
-	if(((button == GLUT_LEFT_BUTTON) || (button == GLUT_RIGHT_BUTTON)) && state == GLUT_DOWN) 
+	if ((button == GLUT_LEFT_BUTTON) && (state == GLUT_DOWN))
 	{
 		xEyeBegin = x;
@@ -641,5 +638,12 @@
 		glutMotionFunc(leftMotion);
 	}
-	else if(button == GLUT_MIDDLE_BUTTON && state == GLUT_DOWN)
+	else if ((button == GLUT_RIGHT_BUTTON) && (state == GLUT_DOWN))
+	{
+		yEyeBegin = y;
+		yMotionBegin = y;
+
+		glutMotionFunc(rightMotion);
+	}
+	else if ((button == GLUT_MIDDLE_BUTTON) && (state == GLUT_DOWN))
 	{
 		horizontalMotionBegin = x;
@@ -651,42 +655,81 @@
 }
 
-/**
-	rotation for left/right mouse drag
+
+/**	rotation for left/right mouse drag
 	motion for up/down mouse drag
 */
 void leftMotion(int x, int y) 
 {
-	static double eyeXAngle = 0.0;
-	// not move in the vertical direction
-	Vector3 horView = Vector3(viewDir[0], 0, viewDir[2]);
-	
-	eyeXAngle = 0.6 *  M_PI * (xEyeBegin - x) / 180.0;
-
-	/*
-	linCombVector3(eyePos, eyePos, horView, (yMotionBegin - y) * 0.1);
-	
-	rotateVectorY(viewDir, eyeXAngle);
+	static float eyeXAngle = 0.0f;
+
+	Vector3 viewDir = camera->GetDirection();
+	Vector3 pos = camera->GetPosition();
+
+	// don't move in the vertical direction
+	Vector3 horView(viewDir[0], 0, viewDir[2]);
+	
+	eyeXAngle = -0.2f *  M_PI * (xEyeBegin - x) / 180.0;
+
+	// rotate view vector
+	Matrix4x4 rot = RotationYMatrix(eyeXAngle);
+	viewDir = rot * viewDir;
+
+	pos += horView * (yMotionBegin - y) * 0.2f;
+
+	camera->SetDirection(viewDir);
+	camera->SetPosition(pos);
 	
 	xEyeBegin = x;
 	yMotionBegin = y;
-	*/
+
 	glutPostRedisplay();
 }
+
+
+/**	rotation for left/right mouse drag
+	motion for up/down mouse drag
+*/
+void rightMotion(int x, int y) 
+{
+	static float eyeYAngle = 0.0f;
+
+	Vector3 viewDir = camera->GetDirection();
+	Vector3 right = camera->GetRightVector();
+
+	eyeYAngle = -0.2f *  M_PI * (yEyeBegin - y) / 180.0;
+
+	// rotate view vector
+	Matrix4x4 rot = RotationAxisMatrix(right, eyeYAngle);
+	viewDir = rot * viewDir;
+
+	camera->SetDirection(viewDir);
+		
+	yEyeBegin = y;
+	
+	glutPostRedisplay();
+}
+
 
 // strafe
 void middleMotion(int x, int y) 
 {
+	Vector3 viewDir = camera->GetDirection();
+	Vector3 pos = camera->GetPosition();
+
 	// the 90 degree rotated view vector 
 	// y zero so we don't move in the vertical
-	Vector3 rVec = Vector3(viewDir[0], 0, viewDir[2]);
-	
-	/*rotateVectorY(rVec, PI / 2.0);
-	linCombVector3(eyePos, eyePos, rVec, (horizontalMotionBegin - x) * 0.1);
-	
-	eyePos[1] += (verticalMotionBegin - y) * 0.1;
+	Vector3 rVec(viewDir[0], 0, viewDir[2]);
+	
+	Matrix4x4 rot = RotationYMatrix(M_PI * 0.5f);
+	rVec = rot * rVec;
+	
+	pos += rVec * (x - horizontalMotionBegin) * 0.1f;
+	pos[1] += (verticalMotionBegin - y) * 0.1f;
+
+	camera->SetPosition(pos);
 
 	horizontalMotionBegin = x;
 	verticalMotionBegin = y;
-*/
+
 	glutPostRedisplay();
 }
