Index: trunk/src/gl/gl_context.cc
===================================================================
--- trunk/src/gl/gl_context.cc	(revision 461)
+++ trunk/src/gl/gl_context.cc	(revision 462)
@@ -121,5 +121,4 @@
 		glBindFramebuffer( GL_FRAMEBUFFER, info->glid );
 		unsigned gl_type = texture_type_to_enum( tinfo->type );
-
 		if ( tinfo )
 		{
@@ -141,5 +140,6 @@
 	{
 		glBindFramebuffer( GL_FRAMEBUFFER, info->glid );
-		if ( info->depth_rb_glid ) glDeleteRenderbuffers( 1, &(info->depth_rb_glid) );
+		if ( info->depth_rb_glid ) 
+			glDeleteRenderbuffers( 1, &(info->depth_rb_glid) );
 		glGenRenderbuffers( 1, &(info->depth_rb_glid) );
 		glBindRenderbuffer( GL_RENDERBUFFER, info->depth_rb_glid );
@@ -165,4 +165,6 @@
 bool nv::gl_context::check( framebuffer_slot ft )
 {
+ 	glDrawBuffer( 0 );
+ 	glReadBuffer( 0 );
 	if ( is_gl_extension_loaded( GL_EXT_FRAMEBUFFER_OBJECT ) && is_gl_extension_loaded( GL_EXT_FRAMEBUFFER_BLIT ) )
 	{
@@ -185,4 +187,6 @@
 		NV_LOG_ERROR( "gl_context::check : Framebuffer extensions not loaded!" );
 	}
+	glDrawBuffer( GL_BACK );
+	glReadBuffer( GL_BACK );
 	return false;
 }
@@ -592,13 +596,13 @@
 		if ( m_render_state.culling.face != cull.face )
 		{
-			glCullFace( culling_face_type_to_enum(cull.face) );
+			glCullFace( culling_face_type_to_enum( cull.face ) );
 			m_render_state.culling.face = cull.face;
 		}
-
-		if ( m_render_state.culling.order != cull.order )
-		{
-			glFrontFace( culling_order_type_to_enum( cull.order ) );
-			m_render_state.culling.order = cull.order;
-		}
+	}
+
+	if ( m_render_state.culling.order != cull.order )
+	{
+		glFrontFace( culling_order_type_to_enum( cull.order ) );
+		m_render_state.culling.order = cull.order;
 	}
 }
@@ -688,4 +692,5 @@
 	load_gl_extensions( GL_EXT_FRAMEBUFFER_BLIT | GL_EXT_FRAMEBUFFER_OBJECT );
 	force_apply_render_state( m_render_state );
+
 }
 
Index: trunk/src/gl/gl_enum.cc
===================================================================
--- trunk/src/gl/gl_enum.cc	(revision 461)
+++ trunk/src/gl/gl_enum.cc	(revision 462)
@@ -185,4 +185,7 @@
 	case BGRA    : return GL_BGRA;
 	case RED     : return GL_RED;
+	case DEPTH16 : return GL_DEPTH_COMPONENT;
+	case DEPTH24 : return GL_DEPTH_COMPONENT;
+	case DEPTH32 : return GL_DEPTH_COMPONENT;
 	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
@@ -202,5 +205,7 @@
 	case BGRA    : return GL_RGBA8;
 	case RED     : return 0x8040; // GL_LUMINANCE8; // TODO: change to GL_R8!
-
+	case DEPTH16 : return GL_DEPTH_COMPONENT16;
+	case DEPTH24 : return GL_DEPTH_COMPONENT24;
+	case DEPTH32:  return GL_DEPTH_COMPONENT32;
 	NV_RETURN_COVERED_DEFAULT( 0 );
 	}
