From b84e24d6622a0b9de3ffc8b2a9cc1979a1c49f53 Mon Sep 17 00:00:00 2001 From: krzys-h Date: Thu, 24 Mar 2016 18:45:51 +0100 Subject: [PATCH] Fixed VBOs never being used even if available --- src/graphics/opengl/gldevice.cpp | 16 ++++++++-------- src/graphics/opengl/gldevice.h | 2 -- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/graphics/opengl/gldevice.cpp b/src/graphics/opengl/gldevice.cpp index 351f1f24..1e15e2d1 100644 --- a/src/graphics/opengl/gldevice.cpp +++ b/src/graphics/opengl/gldevice.cpp @@ -1519,7 +1519,7 @@ void CGLDevice::DrawPrimitives(PrimitiveType type, const VertexCol *vertices, unsigned int CGLDevice::CreateStaticBuffer(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) { unsigned int id = 0; - if (m_vboAvailable) + if (m_vertexBufferType != VBT_DISPLAY_LIST) { id = ++m_lastVboId; @@ -1563,7 +1563,7 @@ unsigned int CGLDevice::CreateStaticBuffer(PrimitiveType primitiveType, const Ve unsigned int CGLDevice::CreateStaticBuffer(PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) { unsigned int id = 0; - if (m_vboAvailable) + if (m_vertexBufferType != VBT_DISPLAY_LIST) { id = ++m_lastVboId; @@ -1607,7 +1607,7 @@ unsigned int CGLDevice::CreateStaticBuffer(PrimitiveType primitiveType, const Ve unsigned int CGLDevice::CreateStaticBuffer(PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount) { unsigned int id = 0; - if (m_vboAvailable) + if (m_vertexBufferType != VBT_DISPLAY_LIST) { id = ++m_lastVboId; @@ -1650,7 +1650,7 @@ unsigned int CGLDevice::CreateStaticBuffer(PrimitiveType primitiveType, const Ve void CGLDevice::UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const Vertex* vertices, int vertexCount) { - if (m_vboAvailable) + if (m_vertexBufferType != VBT_DISPLAY_LIST) { auto it = m_vboObjects.find(bufferId); if (it == m_vboObjects.end()) @@ -1686,7 +1686,7 @@ void CGLDevice::UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiv void CGLDevice::UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexTex2* vertices, int vertexCount) { - if (m_vboAvailable) + if (m_vertexBufferType != VBT_DISPLAY_LIST) { auto it = m_vboObjects.find(bufferId); if (it == m_vboObjects.end()) @@ -1722,7 +1722,7 @@ void CGLDevice::UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiv void CGLDevice::UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiveType, const VertexCol* vertices, int vertexCount) { - if (m_vboAvailable) + if (m_vertexBufferType != VBT_DISPLAY_LIST) { auto it = m_vboObjects.find(bufferId); if (it == m_vboObjects.end()) @@ -1758,7 +1758,7 @@ void CGLDevice::UpdateStaticBuffer(unsigned int bufferId, PrimitiveType primitiv void CGLDevice::DrawStaticBuffer(unsigned int bufferId) { - if (m_vboAvailable) + if (m_vertexBufferType != VBT_DISPLAY_LIST) { auto it = m_vboObjects.find(bufferId); if (it == m_vboObjects.end()) @@ -1847,7 +1847,7 @@ void CGLDevice::DrawStaticBuffer(unsigned int bufferId) void CGLDevice::DestroyStaticBuffer(unsigned int bufferId) { - if (m_vboAvailable) + if (m_vertexBufferType != VBT_DISPLAY_LIST) { auto it = m_vboObjects.find(bufferId); if (it == m_vboObjects.end()) diff --git a/src/graphics/opengl/gldevice.h b/src/graphics/opengl/gldevice.h index ad56fcad..baaaa3b8 100644 --- a/src/graphics/opengl/gldevice.h +++ b/src/graphics/opengl/gldevice.h @@ -276,8 +276,6 @@ private: //! Detected capabilities //! Depth texture support ShadowMappingSupport m_shadowMappingSupport = SMS_NONE; - //! Whether to use VBOs or display lists - bool m_vboAvailable = false; //! glMultiDrawArrays() available bool m_multiDrawArrays = false; //! Framebuffer support