Index: code/graphics/gropengltnl.cpp
===================================================================
--- code/graphics/gropengltnl.cpp	(revision 8555)
+++ code/graphics/gropengltnl.cpp	(working copy)
@@ -357,7 +357,7 @@
 	for (j = 0; j < vb->tex_buf.size(); j++) {
 		n_verts = vb->tex_buf[j].n_verts;
 		uint offset = vb->tex_buf[j].index_offset;
-		uint *index = vb->tex_buf[j].index;
+		const uint *index = vb->tex_buf[j].get_index();
 
 		// bump to our spot in the buffer
 		GLubyte *ibuf = m_vbp->index_list + offset;
@@ -494,7 +494,7 @@
 	if (Cmdline_drawelements) \
 		glDrawElements(GL_TRIANGLES, count, element_type, ibuffer + (datap->index_offset + start)); \
 	else \
-		vglDrawRangeElements(GL_TRIANGLES, start, end, count, element_type, ibuffer + (datap->index_offset + start));
+		vglDrawRangeElements(GL_TRIANGLES, datap->i_first, datap->i_last, count, element_type, ibuffer + (datap->index_offset + start));
 
 int GL_last_shader_flags = -1;
 int GL_last_shader_index = -1;
Index: code/graphics/2d.h
===================================================================
--- code/graphics/2d.h	(revision 8555)
+++ code/graphics/2d.h	(working copy)
@@ -109,7 +109,12 @@
 
 	size_t index_offset;
 
-	uint *index;
+	const uint *get_index() const
+	{
+		return index;
+	}
+	
+        uint i_first, i_last;
 
 	void release()
 	{
@@ -119,10 +124,26 @@
 		}
 	}
 
-	buffer_data() :
-		flags(0), texture(-1), n_verts(0), index_offset(0), index(NULL)
+	void assign(int i, uint j)
 	{
+		const_cast<uint *>(index)[i] = j;
+		if (i_first > i_last)
+			i_first = i_last = j;
+		else if (i_first > j)
+			i_first = j;
+		else if (i_last < j)
+			i_last = j;
 	}
+
+	buffer_data(int n_vrts) :
+		flags(0), texture(-1), n_verts(n_vrts), index_offset(0),
+		i_first(1), i_last(0)
+	{
+		index = new(std::nothrow) uint[n_verts];
+	}
+
+private:
+	uint *index;
 };
 
 struct vertex_buffer {
Index: code/model/modelinterp.cpp
===================================================================
--- code/model/modelinterp.cpp	(revision 8555)
+++ code/model/modelinterp.cpp	(working copy)
@@ -4244,22 +4244,21 @@
 		if ( !polygon_list[i].n_verts )
 			continue;
 
-		buffer_data new_buffer;
+		buffer_data new_buffer(polygon_list[i].n_verts);
 
-		new_buffer.index = new(std::nothrow) uint[polygon_list[i].n_verts];
-		Verify( new_buffer.index != NULL );
+		Verify( new_buffer.get_index() != NULL );
 
 		for (j = 0; j < polygon_list[i].n_verts; j++) {
 			if (ibuffer_info.read != NULL) {
 				first_index = cfread_int(ibuffer_info.read);
 				Assert( first_index >= 0 );
 
-				new_buffer.index[j] = (uint)first_index;
+				new_buffer.assign(j, first_index);
 			} else {
 				first_index = model_list->find_index(&polygon_list[i], j);
 				Assert(first_index != -1);
 
-				new_buffer.index[j] = (uint)first_index;
+				new_buffer.assign(j, first_index);
 
 				if (ibuffer_info.write != NULL) {
 					cfwrite_int(first_index, ibuffer_info.write);
@@ -4267,7 +4266,6 @@
 			}
 		}
 
-		new_buffer.n_verts = polygon_list[i].n_verts;
 		new_buffer.texture = i;
 
 		new_buffer.flags = 0;
