+ m_objbounds_vbo.UnMap();
+ m_buffer_dirty = false;
+}
+
+void View::PrepareRender()
+{
+ // TODO: Error check here.
+ m_rect_outline_shader.AttachGeometryProgram(RECT_OUTLINE_GEOM);
+ m_rect_outline_shader.AttachVertexProgram(RECT_VERT);
+ m_rect_outline_shader.AttachFragmentProgram(RECT_FRAG);
+ m_rect_outline_shader.Link();
+ m_rect_outline_shader.Use();
+ glUniform4f(m_rect_outline_shader.GetUniformLocation("colour"), m_colour.r, m_colour.g, m_colour.b, m_colour.a);
+
+ m_rect_filled_shader.AttachGeometryProgram(RECT_FILLED_GEOM);
+ m_rect_filled_shader.AttachVertexProgram(RECT_VERT);
+ m_rect_filled_shader.AttachFragmentProgram(RECT_FRAG);
+ m_rect_filled_shader.Link();
+ m_rect_filled_shader.Use();
+ glUniform4f(m_rect_filled_shader.GetUniformLocation("colour"), m_colour.r, m_colour.g, m_colour.b, m_colour.a);
+
+ m_bounds_ubo.SetType(GraphicsBuffer::BufferTypeUniform);
+ m_bounds_ubo.SetUsage(GraphicsBuffer::BufferUsageStreamDraw);
+
+ m_outline_ibo.SetUsage(GraphicsBuffer::BufferUsageStaticDraw);
+ m_outline_ibo.SetType(GraphicsBuffer::BufferTypeIndex);
+ m_outline_ibo.Resize(m_document.ObjectCount() * 2 * sizeof(uint32_t));
+ BufferBuilder<uint32_t> outline_builder(m_outline_ibo.Map(false, true, true), m_outline_ibo.GetSize());
+
+ m_filled_ibo.SetUsage(GraphicsBuffer::BufferUsageStaticDraw);
+ m_filled_ibo.SetType(GraphicsBuffer::BufferTypeIndex);
+ m_filled_ibo.Resize(m_document.ObjectCount() * 2 * sizeof(uint32_t));
+ BufferBuilder<uint32_t> filled_builder(m_filled_ibo.Map(false, true, true), m_filled_ibo.GetSize());
+
+
+ m_rendered_filled = m_rendered_outline = 0;
+ uint32_t currentIndex = 0;