Remove CGL14Device's support for display lists

Closes #1153.
1008-fix
AbigailBuccaneer 2018-05-04 13:34:37 +01:00
parent f8ebc6ec21
commit c9a8a242a0
2 changed files with 93 additions and 144 deletions

View File

@ -257,7 +257,6 @@ bool CGL14Device::Create()
if (glVersion >= 15)
{
GetLogger()->Info("Core VBO supported\n", glMajor, glMinor);
m_vertexBufferType = VBT_VBO_CORE;
// Set function pointers
m_glGenBuffers = glGenBuffers;
@ -269,7 +268,6 @@ bool CGL14Device::Create()
else if (vboARB) // VBO ARB extension available
{
GetLogger()->Info("ARB VBO supported\n");
m_vertexBufferType = VBT_VBO_ARB;
// Set function pointers
m_glGenBuffers = glGenBuffersARB;
@ -280,8 +278,11 @@ bool CGL14Device::Create()
}
else // no VBO support
{
GetLogger()->Info("VBO not supported\n");
m_vertexBufferType = VBT_DISPLAY_LIST;
m_errorMessage = "Your graphics card or drivers don't support OpenGL 1.5 or vertex buffer objects.\n"
"Ensure you have the latest graphics drivers for your graphics card.\n\n";
GetLogger()->Error(m_errorMessage.c_str());
m_errorMessage += GetHardwareInfo();
return false;
}
// This is mostly done in all modern hardware by default
@ -1476,10 +1477,7 @@ void CGL14Device::DrawPrimitives(PrimitiveType type, const VertexCol *vertices,
template <typename Vertex>
unsigned int CGL14Device::CreateStaticBufferImpl(PrimitiveType primitiveType, const Vertex* vertices, int vertexCount)
{
unsigned int id = 0;
if (m_vertexBufferType != VBT_DISPLAY_LIST)
{
id = ++m_lastVboId;
unsigned int id = ++m_lastVboId;
VboObjectInfo info;
info.primitiveType = primitiveType;
@ -1493,25 +1491,12 @@ unsigned int CGL14Device::CreateStaticBufferImpl(PrimitiveType primitiveType, co
m_glBindBuffer(GL_ARRAY_BUFFER, 0);
m_vboObjects[id] = info;
}
else
{
id = glGenLists(1);
glNewList(id, GL_COMPILE);
DrawPrimitive(primitiveType, vertices, vertexCount);
glEndList();
}
return id;
}
template <typename Vertex>
void CGL14Device::UpdateStaticBufferImpl(unsigned int bufferId, PrimitiveType primitiveType, const Vertex* vertices, int vertexCount)
{
if (m_vertexBufferType != VBT_DISPLAY_LIST)
{
auto it = m_vboObjects.find(bufferId);
if (it == m_vboObjects.end())
@ -1526,19 +1511,8 @@ void CGL14Device::UpdateStaticBufferImpl(unsigned int bufferId, PrimitiveType pr
m_glBufferData(GL_ARRAY_BUFFER, vertexCount * sizeof(Vertex), vertices, GL_STATIC_DRAW);
m_glBindBuffer(GL_ARRAY_BUFFER, 0);
}
else
{
glNewList(bufferId, GL_COMPILE);
DrawPrimitive(primitiveType, vertices, vertexCount);
glEndList();
}
}
void CGL14Device::DrawStaticBuffer(unsigned int bufferId)
{
if (m_vertexBufferType != VBT_DISPLAY_LIST)
{
auto it = m_vboObjects.find(bufferId);
if (it == m_vboObjects.end())
@ -1609,15 +1583,8 @@ void CGL14Device::DrawStaticBuffer(unsigned int bufferId)
m_glBindBuffer(GL_ARRAY_BUFFER, 0);
}
else
{
glCallList(bufferId);
}
}
void CGL14Device::DestroyStaticBuffer(unsigned int bufferId)
{
if (m_vertexBufferType != VBT_DISPLAY_LIST)
{
auto it = m_vboObjects.find(bufferId);
if (it == m_vboObjects.end())
@ -1627,11 +1594,6 @@ void CGL14Device::DestroyStaticBuffer(unsigned int bufferId)
m_vboObjects.erase(it);
}
else
{
glDeleteLists(bufferId, 1);
}
}
/* Based on libwine's implementation */

View File

@ -43,17 +43,6 @@
namespace Gfx
{
/**
\enum VertexBufferType
\brief Specifies type of vertex buffer to use
*/
enum VertexBufferType
{
VBT_DISPLAY_LIST, //! use display lists
VBT_VBO_CORE, //! use core OpenGL 1.5 VBOs
VBT_VBO_ARB //! use ARB extension VBOs
};
enum ShadowMappingSupport
{
SMS_NONE, //! No support for depth textures
@ -295,8 +284,6 @@ private:
bool m_multiDrawArrays = false;
//! Framebuffer support
FramebufferSupport m_framebufferSupport = FBS_NONE;
//! Which vertex buffer type to use
VertexBufferType m_vertexBufferType = VBT_DISPLAY_LIST;
//! Map of saved VBO objects
std::map<unsigned int, VboObjectInfo> m_vboObjects;
//! Last ID of VBO object