Index: branches/terrain/src/lib/graphics/importer/terrain/terrain.cc
===================================================================
--- branches/terrain/src/lib/graphics/importer/terrain/terrain.cc	(revision 8647)
+++ branches/terrain/src/lib/graphics/importer/terrain/terrain.cc	(revision 8648)
@@ -51,6 +51,6 @@
 				x > 0 			? getPage( x-1, z+0 ) : NULL,
 				x < pagesX-1	? getPage( x+1, z+0 ) : NULL, 
-				z > 0 			? getPage( x+0, z-1 ) : NULL,
-				z < pagesZ-1	? getPage( x+0, z+1 ) : NULL );
+				z < pagesZ-1	? getPage( x+0, z+1 ) : NULL,
+				z > 0 			? getPage( x+0, z-1 ) : NULL );
 	
 	printf( "looks good\n" );
@@ -69,9 +69,5 @@
 		node->setChildren( NULL, NULL, NULL, NULL );
 	}
-	else {
-		assert( ( _x0 % 2 ) == 0 ); 
-		assert( ( _x1 % 2 ) == 0 ); 
-		assert( ( _z0 % 2 ) == 0 ); 
-		assert( ( _z1 % 2 ) == 0 );		
+	else {	
 		node = new TerrainQuad( this, _x0, _z0, _x1, _z1 );
 		node->setChildren( 
@@ -200,5 +196,7 @@
 	broker->acquire( bi.vbIdentifier, bi.ibIdentifier );
 	buffers.push_back( bi );
+	int dirtyRounds = 0;
 	do {
+		dirtyRounds++;
 		dirty = false;
 		page = activePages;
@@ -211,11 +209,11 @@
 			}
 			wantedLeft = wantedRight = wantedBottom = wantedTop = page->getWantedLOD();
-			if ( ( neighbor = page->getLeft() ) ) 
+			if ( ( neighbor = page->getLeft() ) && ( neighbor->isActive() ) ) 
 				wantedLeft = neighbor->getWantedLOD();
-			if ( ( neighbor = page->getRight() ) ) 
+			if ( ( neighbor = page->getRight() ) && ( neighbor->isActive() ) ) 
 				wantedRight = neighbor->getWantedLOD();
-			if ( ( neighbor = page->getTop() ) ) 
+			if ( ( neighbor = page->getTop() ) && ( neighbor->isActive() ) ) 
 				wantedTop = neighbor->getWantedLOD();
-			if ( ( neighbor = page->getBottom() ) ) 
+			if ( ( neighbor = page->getBottom() ) && ( neighbor->isActive() ) ) 
 				wantedBottom = neighbor->getWantedLOD();			
 		
@@ -224,9 +222,10 @@
 			if ( minLOD < page->getWantedLOD()-1 ) {
 				page->setWantedLOD( minLOD+1 );
-				//dirty = true;
+				dirty = true;
 			}	
 			page = page->getNext();
 		}
 	} while ( dirty );
+	printf( "dirtyrounds: %d\n", dirtyRounds );
 	page = activePages;
 	
@@ -247,5 +246,6 @@
 			indices, GL_DYNAMIC_DRAW_ARB );
 	}
-	s = 500.0f;
+	s = 200.0f;
+	glPushAttrib( GL_COLOR_BUFFER_BIT );
 	for ( unsigned int i = 0; i < materials.size(); ++i ) {
 		page = activePages;	
@@ -308,4 +308,7 @@
 	glDisableClientState( GL_TEXTURE_COORD_ARRAY );	
 	glEnable( GL_LIGHTING );
+	glMatrixMode( GL_TEXTURE );
+	glLoadIdentity();
+	glPopAttrib();
 }
 
Index: branches/terrain/src/lib/graphics/importer/terrain/terrain_page.cc
===================================================================
--- branches/terrain/src/lib/graphics/importer/terrain/terrain_page.cc	(revision 8647)
+++ branches/terrain/src/lib/graphics/importer/terrain/terrain_page.cc	(revision 8648)
@@ -98,5 +98,5 @@
 		_adapt[TP_RIGHT] = ( wantedLOD - right->getWantedLOD() ) > 0;
 		
-	if ( top && top->isVisible) 
+	if ( top && top->isVisible ) 
 		_adapt[TP_TOP] = ( wantedLOD - top->getWantedLOD() ) > 0;				
 		
@@ -128,12 +128,4 @@
 		wantedLOD = TerrainPage::MAX_LODS-1;
 	}	
-	// Calculate the tween factor. The calculation is different if LOD is 0
-	// 
-	if ( wantedLOD > 0 ) {
-		
-	}
-	else {
-		
-	}
 	return wantedLOD;
 }
@@ -244,8 +236,12 @@
 {
 	
-	bool 	leftChanged 	= ( left && left->isVisible ) && ( left->wantedLOD != left->currentLOD ),
-			rightChanged	= ( right && right->isVisible ) && ( right->wantedLOD != right->currentLOD ),
-			topChanged		= ( top && top->isVisible ) && ( top->wantedLOD != currentLOD ),
-			bottomChanged	= ( bottom && bottom->isVisible ) && ( bottom->wantedLOD != bottom->currentLOD ),
+	bool 	leftChanged 	= ( left && left->isActive() ) &&
+	 			( left->wantedLOD != left->currentLOD ),
+			rightChanged	= ( right && right->isActive() ) && 
+				( right->wantedLOD != right->currentLOD ),
+			topChanged		= ( top && top->isActive() ) && 
+				( top->wantedLOD != currentLOD ),
+			bottomChanged	= ( bottom && bottom->isActive() ) && 
+				( bottom->wantedLOD != bottom->currentLOD ),
 			iChanged		=  wantedLOD != currentLOD;
 				
@@ -518,10 +514,10 @@
 	int zStart = 0, zEnd = owner->getPageSize()-stride;
 	
-	if ( adapt[TP_TOP] ) {
+	if ( adapt[TP_BOTTOM] ) {
 		tesselateRow( 0, stride / 2, stride, adapt[TP_LEFT], adapt[TP_RIGHT] );
 		zStart+= stride;
 	}
 	
-	if ( adapt[TP_BOTTOM] )
+	if ( adapt[TP_TOP] )
 		zEnd-= stride;
 		
@@ -530,10 +526,9 @@
 	
 
-	if ( adapt[TP_BOTTOM] ) {
-		
-	addAgain( );
-	addIndex( getIndex( 0, owner->getPageSize()-1-stride ) );
-	
-	tesselateRow( owner->getPageSize()-1-stride, stride / 2, stride, adapt[TP_LEFT], adapt[TP_RIGHT] );
+	if ( adapt[TP_TOP] ) {
+		addAgain( );
+		addIndex( getIndex( 0, owner->getPageSize()-1-stride ) );
+		tesselateRow( owner->getPageSize()-1-stride, stride / 2, 
+			stride, adapt[TP_LEFT], adapt[TP_RIGHT] );
 	}
 	
Index: branches/terrain/src/lib/graphics/importer/terrain/terrain_page.h
===================================================================
--- branches/terrain/src/lib/graphics/importer/terrain/terrain_page.h	(revision 8647)
+++ branches/terrain/src/lib/graphics/importer/terrain/terrain_page.h	(revision 8648)
@@ -210,5 +210,4 @@
 			return true;
 		}
-		
 		inline void setWantedLOD( int _lod )
 		{
Index: branches/terrain/src/world_entities/camera.cc
===================================================================
--- branches/terrain/src/world_entities/camera.cc	(revision 8647)
+++ branches/terrain/src/world_entities/camera.cc	(revision 8648)
@@ -36,5 +36,5 @@
   this->setFovy(60.0);
   this->setAspectRatio(1.2f);
-  this->setClipRegion( .1, 80.0f );
+  this->setClipRegion( .1, 40.0f );
 
   this->setViewMode(Camera::ViewNormal);
@@ -83,5 +83,5 @@
 {
   this->nearClip = nearClip;
-  this->farClip = farClip;
+  this->farClip = 400.0f;//farClip;
 }
 
Index: branches/terrain/src/world_entities/skybox.cc
===================================================================
--- branches/terrain/src/world_entities/skybox.cc	(revision 8647)
+++ branches/terrain/src/world_entities/skybox.cc	(revision 8648)
@@ -230,5 +230,5 @@
 //   glPushAttrib(GL_LIGHTING_BIT);
   glDisable(GL_LIGHTING);
-
+  glDisable( GL_DEPTH_TEST );	
   glDisable(GL_FOG);
 
