Make Qt4 work
[ipdf/code.git] / src / graphicsbuffer.cpp
index da522dc..217fa9a 100644 (file)
@@ -74,6 +74,7 @@ GraphicsBuffer::GraphicsBuffer()
        m_buffer_handle = 0;
        m_buffer_usage = BufferUsageDynamicDraw;
        m_faking_map = false;
+       m_name = "Unnamed Buffer";
        SetUsage(BufferUsageStaticDraw);
 }
 
@@ -91,6 +92,11 @@ void GraphicsBuffer::SetType(GraphicsBuffer::BufferType bufType)
        m_buffer_type = bufType;
 }
 
+void GraphicsBuffer::SetName(const char *name)
+{
+       m_name = name;
+}
+
 void GraphicsBuffer::SetUsage(GraphicsBuffer::BufferUsage bufUsage)
 {
        if (bufUsage != m_buffer_usage)
@@ -125,6 +131,7 @@ bool GraphicsBuffer::RecreateBuffer(const void *data)
                glDeleteBuffers(1, &m_buffer_handle);
        }
        glGenBuffers(1, &m_buffer_handle);
+       glObjectLabel(GL_BUFFER, m_buffer_handle, -1, m_name);
        m_buffer_shape_dirty = false;
        if (m_buffer_size)
                Upload(m_buffer_size, data);
@@ -242,6 +249,8 @@ void GraphicsBuffer::Resize(size_t length)
        }
        else
        {
+               glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, -1, "Resizing buffer.");
+               glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_HIGH, 0, NULL, GL_TRUE);
                // Create a new buffer and copy the old data into it.
                UnMap();
                GLuint old_buffer = m_buffer_handle;    
@@ -252,6 +261,7 @@ void GraphicsBuffer::Resize(size_t length)
                glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, m_buffer_size);
                glDeleteBuffers(1, &old_buffer);
                m_buffer_size = length;
+               glPopDebugGroup();
        }
 }
 

UCC git Repository :: git.ucc.asn.au