Index: freespace.cpp
===================================================================
RCS file: /home/fs2source/cvsroot/fs2_open/code/freespace2/freespace.cpp,v
retrieving revision 2.302
diff -u -r2.302 freespace.cpp
--- freespace.cpp	23 Nov 2007 23:49:32 -0000	2.302
+++ freespace.cpp	5 Jan 2008 04:35:32 -0000
@@ -4597,7 +4597,7 @@
 
 		//	Numeric constants encouraged by J "pig farmer" S, who shall remain semi-anonymous.
 		// J.S. I've changed my ways!! See the new "no constants" code!!!
-		gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );	
+		gr_set_scissor(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2);
 	}
 	else if((Cutscene_bar_flags & CUB_GRADUAL) && Cutscene_bars_progress < 1.0f)
 	{
@@ -4620,18 +4620,18 @@
 			yborder = gr_screen.max_h/6 - fl2i(Cutscene_bars_progress*(gr_screen.max_h/8));
 
 		//Set teh clipping
-		gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );	
+		gr_set_scissor(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2);	
 	}
 	else if(Cutscene_bar_flags & CUB_CUTSCENE)
 	{
 		int yborder = gr_screen.max_h/6;
 
-		gr_set_clip(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2, false );	
+		gr_set_scissor(0, yborder, gr_screen.max_w, gr_screen.max_h - yborder*2);	
 	}
 	else {
 		// Set the clip region for normal view
 		if ( View_percent >= 100 )	{
-			gr_reset_clip();
+			gr_unset_scissor();
 		} else {
 			int xborder, yborder;
 
@@ -4646,7 +4646,7 @@
 			xborder = ( gr_screen.max_w*(100-fi) )/200;
 			yborder = ( gr_screen.max_h*(100-fi) )/200;
 
-			gr_set_clip(xborder, yborder, gr_screen.max_w-xborder*2,gr_screen.max_h-yborder*2, false );
+			gr_set_scissor(xborder, yborder, gr_screen.max_w-xborder*2,gr_screen.max_h-yborder*2);
 		}
 	}
 }
 
 
 Index: gropengl.cpp
===================================================================
RCS file: /home/fs2source/cvsroot/fs2_open/code/graphics/gropengl.cpp,v
retrieving revision 2.203
diff -u -r2.203 gropengl.cpp
--- gropengl.cpp	23 Nov 2007 21:58:10 -0000	2.203
+++ gropengl.cpp	5 Jan 2008 04:29:27 -0000
@@ -1705,6 +1705,48 @@
 	// Not used.
 }
 
+void gr_opengl_set_scissor(int x, int y, int w, int h)
+{
+	// check for sanity of parameters
+	if (x < 0)
+		x = 0;
+	if (y < 0)
+		y = 0;
+
+	int max_w = gr_screen.max_w;
+	int max_h = gr_screen.max_h;
+
+	if (x >= max_w)
+		x = max_w - 1;
+	if (y >= max_h)
+		y = max_h - 1;
+
+	if (x + w > max_w)
+		w = max_w - x;
+	if (y + h > max_h)
+		h = max_h - y;
+	
+	if (w > max_w)
+		w = max_w;
+	if (h > max_h)
+		h = max_h;
+
+	// just return early if we aren't actually going to need the scissor test
+	if ( (x == 0) && (y == 0) && (w == max_w) && (h == max_h) ) {
+		glDisable(GL_SCISSOR_TEST);
+		return;
+	}
+	
+	glEnable(GL_SCISSOR_TEST);
+	glScissor(x, gr_screen.max_h - y - h, w, h);
+}
+
+void gr_opengl_unset_scissor()
+{
+    glDisable(GL_SCISSOR_TEST);
+}
+
+
 void gr_opengl_set_clip(int x, int y, int w, int h, bool resize)
 {
 	// check for sanity of parameters
@@ -4584,6 +4626,8 @@
 
 	gr_screen.gf_flip				= gr_opengl_flip;
 	gr_screen.gf_flip_window		= gr_opengl_flip_window;
+    gr_screen.gf_set_scissor        = gr_opengl_set_scissor;
+    gr_screen.gf_unset_scissor      = gr_opengl_unset_scissor;
 	gr_screen.gf_set_clip			= gr_opengl_set_clip;
 	gr_screen.gf_reset_clip			= gr_opengl_reset_clip;



Index: 2d.h
===================================================================
RCS file: /home/fs2source/cvsroot/fs2_open/code/graphics/2d.h,v
retrieving revision 2.85
diff -u -r2.85 2d.h
--- 2d.h	11 Feb 2007 18:18:52 -0000	2.85
+++ 2d.h	5 Jan 2008 04:33:55 -0000
@@ -921,6 +921,12 @@
 	// resets the clipping region to entire screen
 	void (*gf_reset_clip)();
 
+    // sets the scissor region
+	void (*gf_set_scissor)(int x, int y, int w, int h);
+
+	// resets the scissor region to entire screen
+	void (*gf_unset_scissor)();
+
 	//void (*gf_set_color)( int r, int g, int b );
 	//void (*gf_get_color)( int * r, int * g, int * b );
 	//void (*gf_init_color)( color * dst, int r, int g, int b );
@@ -1236,6 +1242,12 @@
 	(*gr_screen.gf_set_clip)(x,y,w,h,resize);
 }
 #define gr_reset_clip		GR_CALL(gr_screen.gf_reset_clip)
+
+__inline void gr_set_scissor(int x, int y, int w, int h)
+{
+	(*gr_screen.gf_set_scissor)(x,y,w,h);
+}
+#define gr_unset_scissor		GR_CALL(gr_screen.gf_unset_scissor)
 //#define gr_set_font			GR_CALL(gr_screen.gf_set_font)
 
 //#define gr_init_color		GR_CALL(gr_screen.gf_init_color)
